SpannableString

public class SpannableString extends Object
implements CharSequence CharSequence GetChars Spannable

This is the class for text whose content is immutable but to which markup objects can be attached and detached. For mutable text, see SpannableStringBuilder.

Inherited Constant Summary

Public Constructor Summary

SpannableString(CharSequence source)

Public Method Summary

final char
charAt(int i)
boolean
equals(Object o)
final void
getChars(int start, int end, char[] dest, int off)
Exactly like String.getChars(): copy chars start through end - 1 from this CharSequence into dest beginning at offset destoff.
int
getSpanEnd(Object what)
Return the end of the range of text to which the specified markup object is attached, or -1 if the object is not attached.
int
getSpanFlags(Object what)
Return the flags that were specified when Spannable.setSpan(Object, int, int, int) was used to attach the specified markup object, or 0 if the specified object has not been attached.
int
getSpanStart(Object what)
Return the beginning of the range of text to which the specified markup object is attached, or -1 if the object is not attached.
<T> T[]
getSpans(int queryStart, int queryEnd, Class<T> kind)
Return an array of the markup objects attached to the specified slice of this CharSequence and whose type is the specified type or a subclass of it.
int
final int
length()
int
nextSpanTransition(int start, int limit, Class kind)
Return the first offset greater than or equal to start where a markup object of class type begins or ends, or limit if there are no starts or ends greater than or equal to start but less than limit.
void
removeSpan(Object what)
void
setSpan(Object what, int start, int end, int flags)
final CharSequence
subSequence(int start, int end)
final String
static SpannableString
valueOf(CharSequence source)

Inherited Method Summary

Public Constructors

public SpannableString (CharSequence source)

Parameters
source

Public Methods

public final char charAt (int i)

Parameters
i

public boolean equals (Object o)

Parameters
o

public final void getChars (int start, int end, char[] dest, int off)

Exactly like String.getChars(): copy chars start through end - 1 from this CharSequence into dest beginning at offset destoff.

Parameters
start
end
dest
off

public int getSpanEnd (Object what)

Return the end of the range of text to which the specified markup object is attached, or -1 if the object is not attached.

Parameters
what

public int getSpanFlags (Object what)

Return the flags that were specified when Spannable.setSpan(Object, int, int, int) was used to attach the specified markup object, or 0 if the specified object has not been attached.

Parameters
what

public int getSpanStart (Object what)

Return the beginning of the range of text to which the specified markup object is attached, or -1 if the object is not attached.

Parameters
what

public T[] getSpans (int queryStart, int queryEnd, Class<T> kind)

Return an array of the markup objects attached to the specified slice of this CharSequence and whose type is the specified type or a subclass of it. Specify Object.class for the type if you want all the objects regardless of type.

Parameters
queryStart
queryEnd
kind

public int hashCode ()

public final int length ()

public int nextSpanTransition (int start, int limit, Class kind)

Return the first offset greater than or equal to start where a markup object of class type begins or ends, or limit if there are no starts or ends greater than or equal to start but less than limit. Specify null or Object.class for the type if you want every transition regardless of type.

Parameters
start
limit
kind

public void removeSpan (Object what)

Parameters
what

public void setSpan (Object what, int start, int end, int flags)

Parameters
what
start
end
flags

public final CharSequence subSequence (int start, int end)

Parameters
start
end

public final String toString ()

public static SpannableString valueOf (CharSequence source)

Parameters
source