Utility class for manipulating cursors and selections in CharSequences. A cursor is a selection where the start and end are at the same offset.
Field Summary
public static final Object | SELECTION_END | |
public static final Object | SELECTION_START |
Public Method Summary
final static void | |
final static int |
getSelectionEnd(CharSequence text)
Return the offset of the selection edge or cursor, or -1 if
there is no selection or cursor.
|
final static int |
getSelectionStart(CharSequence text)
Return the offset of the selection anchor or cursor, or -1 if
there is no selection or cursor.
|
final static void | |
final static void | |
static void |
setSelection(Spannable text, int start, int stop)
Set the selection anchor to
start and the selection edge
to stop . |
final static void |
Inherited Method Summary
Fields
public static final Object SELECTION_END
public static final Object SELECTION_START
Public Methods
public static final void extendSelection (Spannable text, int index)
Move the selection edge to offset index
.
Parameters
text | |
---|---|
index |
public static final int getSelectionEnd (CharSequence text)
Return the offset of the selection edge or cursor, or -1 if there is no selection or cursor.
Parameters
text |
---|
public static final int getSelectionStart (CharSequence text)
Return the offset of the selection anchor or cursor, or -1 if there is no selection or cursor.
Parameters
text |
---|
public static final void removeSelection (Spannable text)
Remove the selection or cursor, if any, from the text.
Parameters
text |
---|
public static void setSelection (Spannable text, int start, int stop)
Set the selection anchor to start
and the selection edge
to stop
.
Parameters
text | |
---|---|
start | |
stop |
public static final void setSelection (Spannable text, int index)
Move the cursor to offset index
.
Parameters
text | |
---|---|
index |