Android Programming Press on the image to return to the main documentation page.

LabelExtras

Written by Martin Pearman

LabelExtras enables you to apply click listeners to sub-strings of a Label text.
A click on a sub-string raises an event and you can take whatever action you desire on such a click.

List of types:

ClickableSpan
Html
LabelExtras
LinkMovementMethod
SpannableStringBuilder
Spanned
StyleSpan
UnderlineSpan
URLSpan

ClickableSpan


Events:

Click(SelectionStart As Int, SelectionEnd As Int)
Click2(SelectionStart As Int, SelectionEnd As Int, Tag As Object)

Members:


  Initialize (EventName As String, Color As Int, UnderlineText As Boolean)

  Initialize2 (EventName As String, Color As Int, UnderlineText As Boolean, Tag As Object)

  IsInitialized As Boolean

Members description:

Initialize (EventName As String, Color As Int, UnderlineText As Boolean)
Initialize the ClickableSpan.
Color defines the color of the clickable text, pass -1 if you do not wish to change that text color.
UnderlineText defines whether the clickable text shall be underlined.
The Click(SelectionStart As Int, SelectionEnd As Int) event will be raised when this ClickableSpan is clicked.
Initialize2 (EventName As String, Color As Int, UnderlineText As Boolean, Tag As Object)
Initialize the ClickableSpan.
Color defines the color of the clickable text, pass -1 if you do not wish to change that text color.
UnderlineText defines whether the clickable text shall be underlined.
Pass any Object as the Tag and this Object will be returned to the Click2 event.
The Click2(SelectionStart As Int, SelectionEnd As Int, Tag As Object) event will be raised when this ClickableSpan is clicked.
IsInitialized As Boolean

Html


This is an 'Activity Object', it cannot be declared under Sub Process_Globals.

Events:

GetDrawable(Source As String) As Object
HandleTag(Opening As Boolean, Tag As String, SpannableStringBuilder1 As SpannableStringBuilder)

Members:


  EscapeHtml (CharSequence1 As CharSequence) As String

  FromHtml (HtmlString As String) As CharSequence

  FromHtml2 (HtmlString As String, ImageGetterEventName As String, TagHandlerEventName As String) As CharSequence

  ToHtml (CharSequence1 As CharSequence) As CharSequence

Members description:

EscapeHtml (CharSequence1 As CharSequence) As String
Returns an HTML escaped representation of the given plain text.
Only available with Android AP version 16+.
FromHtml (HtmlString As String) As CharSequence
Returns displayable styled text from the provided HTML string.
FromHtml2 (HtmlString As String, ImageGetterEventName As String, TagHandlerEventName As String) As CharSequence
Returns displayable styled text from the provided HTML string.
Using optional ImageGetter (to handle HTML IMG tags in the String) and TagHandler (to handle unrecognised tags in the String) callbacks.
The drawable returned by the ImageGetter sub has to be sized with setBounds.
ToHtml (CharSequence1 As CharSequence) As CharSequence
Returns an HTML representation of the provided Spanned text.

LabelExtras


Events:

None

Members:


  SetDrawableBounds (Drawable1 As android.graphics.drawable.Drawable, Left As Int, Top As Int, Right As Int, Bottom As Int)

  SetMovementMethod (Label1 As android.widget.TextView, MovementMethod1 As android.text.method.MovementMethod)

Members description:

SetDrawableBounds (Drawable1 As android.graphics.drawable.Drawable, Left As Int, Top As Int, Right As Int, Bottom As Int)
Specifies a bounding rectangle for the drawable.
Required for the Html Object ImageGetter callback.
SetMovementMethod (Label1 As android.widget.TextView, MovementMethod1 As android.text.method.MovementMethod)
Sets the movement method (arrow key handler) to be used for this TextView.
To enable the LabelExtras click functionality you must set your Label movement method to an instance of LinkMovementMethod.
The LinkMovementMethod.GetInstance method returns the instance required.

LinkMovementMethod


Events:

None

Members:


  GetInstance As android.text.method.MovementMethod

Members description:

GetInstance As android.text.method.MovementMethod
Returns an instance of the LinkMovementMethod which is required by the LabelExtras.SetMovementMethod method.

SpannableStringBuilder


Events:

None

Members:


  Append (Text As CharSequence) As SpannableStringBuilder

  Append2 (Text As CharSequence, Start As Int, End As Int) As SpannableStringBuilder

  Append3 (Char1 As Char) As SpannableStringBuilder

  CharAt (Where As Int) As Char

  Clear

  ClearSpans

  Delete (Start As Int, End As Int) As SpannableStringBuilder

  GetChars (Start As Int, End As Int, Dest() As Char, DestOffset As Int)

  GetSpanEnd (Span1 As Object) As Int

  GetSpanFlags (Span1 As Object) As Int

  GetSpanStart (Span1 As Object) As Int

  GetStyleSpans (QueryStart As Int, QueryEnd As Int) As StyleSpan()

  GetUnderlineSpans (QueryStart As Int, QueryEnd As Int) As UnderlineSpan()

  GetURLSpans (QueryStart As Int, QueryEnd As Int) As URLSpan()

  Initialize (CharSequence1 As CharSequence)

  IsInitialized As Boolean

  Length As Int [read only]

  NextStyleSpanTransition (Start As Int, Limit As Int) As Int

  NextUnderlineSpanTransition (Start As Int, Limit As Int) As Int

  NextURLSpanTransition (Start As Int, Limit As Int) As Int

  RemoveSpan (Span1 As Object)

  Replace (Start As Int, End As Int, CharSequence1 As CharSequence) As SpannableStringBuilder

  Replace2 (Start As Int, End As Int, CharSequence1 As CharSequence, CharSequence1Start As Int, CharSequence1End As Int) As SpannableStringBuilder

  SetSpan (Span1 As Object, Start As Int, End As Int, Flags As Int)

Members description:

Append (Text As CharSequence) As SpannableStringBuilder
Append2 (Text As CharSequence, Start As Int, End As Int) As SpannableStringBuilder
Append3 (Char1 As Char) As SpannableStringBuilder
CharAt (Where As Int) As Char
Clear
ClearSpans
Delete (Start As Int, End As Int) As SpannableStringBuilder
GetChars (Start As Int, End As Int, Dest() As Char, DestOffset As Int)
GetSpanEnd (Span1 As Object) As Int
GetSpanFlags (Span1 As Object) As Int
GetSpanStart (Span1 As Object) As Int
GetStyleSpans (QueryStart As Int, QueryEnd As Int) As StyleSpan()
GetUnderlineSpans (QueryStart As Int, QueryEnd As Int) As UnderlineSpan()
GetURLSpans (QueryStart As Int, QueryEnd As Int) As URLSpan()
Initialize (CharSequence1 As CharSequence)
Initialize the SpannableStringBuilder with a CharSequence.
A CharSequence can be obtained using the Html.FromHtml method, a String can also be passed as a CharacterSequence.
IsInitialized As Boolean
Length As Int [read only]
Return the number of Chars in the buffer.
NextStyleSpanTransition (Start As Int, Limit As Int) As Int
Return the next offset after Start but less than or equal to Limit where a StyleSpan begins or ends.
NextUnderlineSpanTransition (Start As Int, Limit As Int) As Int
Return the next offset after Start but less than or equal to Limit where an UnderlineSpan begins or ends.
NextURLSpanTransition (Start As Int, Limit As Int) As Int
Return the next offset after Start but less than or equal to Limit where a URLSpan begins or ends.
RemoveSpan (Span1 As Object)
Replace (Start As Int, End As Int, CharSequence1 As CharSequence) As SpannableStringBuilder
Replace2 (Start As Int, End As Int, CharSequence1 As CharSequence, CharSequence1Start As Int, CharSequence1End As Int) As SpannableStringBuilder
SetSpan (Span1 As Object, Start As Int, End As Int, Flags As Int)

Spanned


Events:

None

Members:


  SPAN_EXCLUSIVE_EXCLUSIVE As Int

  SPAN_EXCLUSIVE_INCLUSIVE As Int

  SPAN_INCLUSIVE_EXCLUSIVE As Int

  SPAN_INCLUSIVE_INCLUSIVE As Int

Members description:

SPAN_EXCLUSIVE_EXCLUSIVE As Int
Constant which can be passed as the SpannableStringBuilder.SetSpan method Flags parameter.
Spans of type SPAN_EXCLUSIVE_EXCLUSIVE do not expand to include text inserted at either their starting or ending point.
SPAN_EXCLUSIVE_INCLUSIVE As Int
Constant which can be passed as the SpannableStringBuilder.SetSpan method Flags parameter.
Non-0-length spans of type SPAN_EXCLUSIVE_INCLUSIVE expand to include text inserted at their ending point but not at their starting point.
SPAN_INCLUSIVE_EXCLUSIVE As Int
Constant which can be passed as the SpannableStringBuilder.SetSpan method Flags parameter.
Non-0-length spans of type SPAN_INCLUSIVE_EXCLUSIVE expand to include text inserted at their starting point but not at their ending point.
SPAN_INCLUSIVE_INCLUSIVE As Int
Constant which can be passed as the SpannableStringBuilder.SetSpan method Flags parameter.
Spans of type SPAN_INCLUSIVE_INCLUSIVE expand to include text inserted at either their starting or ending point.

StyleSpan


Events:

None

Members:


  GetStyle As Int

  IsInitialized As Boolean

Members description:

GetStyle As Int
Returns the Typeface style of this StyleSpan.
Typeface.STYLE_BOLD, Typeface.STYLE_ITALIC etc.
IsInitialized As Boolean

UnderlineSpan


Events:

None

Members:


  IsInitialized As Boolean

Members description:

IsInitialized As Boolean

URLSpan


Events:

None

Members:


  GetURL As String

  IsInitialized As Boolean

Members description:

GetURL As String
IsInitialized As Boolean

Top