SurroundingText
class SurroundingText : Parcelable
kotlin.Any | |
↳ | android.view.inputmethod.SurroundingText |
Information about the surrounding text around the cursor for use by an input method.
This contains information about the text and the selection relative to the text.
Summary
Inherited constants | |
---|---|
Public constructors | |
---|---|
SurroundingText(text: CharSequence, selectionStart: Int, selectionEnd: Int, offset: Int) Constructor. |
Public methods | |
---|---|
Int | |
Int |
Returns text offset between the start of the editor's text and the start of the surrounding text. |
Int |
Returns the text offset of the end of the selection in the surrounding text. |
Int |
Returns the text offset of the start of the selection in the surrounding text. |
CharSequence |
getText() Returns the surrounding text around the cursor. |
Unit |
writeToParcel(out: Parcel, flags: Int) Flatten this object in to a Parcel. |
Properties | |
---|---|
static Parcelable.Creator<SurroundingText!> |
Public constructors
SurroundingText
SurroundingText(
text: CharSequence,
selectionStart: Int,
selectionEnd: Int,
offset: Int)
Constructor.
Parameters | |
---|---|
text |
CharSequence: The surrounding text. This value cannot be null . |
selectionStart |
Int: The text offset of the start of the selection in the surrounding text. Reversed selection is allowed. Value is 0 or greater |
selectionEnd |
Int: The text offset of the end of the selection in the surrounding text. Reversed selection is allowed. Value is 0 or greater |
offset |
Int: The text offset between the start of the editor's text and the start of the surrounding text. -1 indicates the offset is unknown. Value is -1 or greater |
Public methods
describeContents
fun describeContents(): Int
Return | |
---|---|
Int |
a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either 0 or android.os.Parcelable#CONTENTS_FILE_DESCRIPTOR |
getOffset
fun getOffset(): Int
Returns text offset between the start of the editor's text and the start of the surrounding text.
-1 indicates the offset information is unknown.
Return | |
---|---|
Int |
Value is -1 or greater |
getSelectionEnd
fun getSelectionEnd(): Int
Returns the text offset of the end of the selection in the surrounding text.
A selection is the current range of the text that is selected by the user, or the current position of the cursor. A cursor is a selection where the start and end are at the same offset.
Return | |
---|---|
Int |
Value is 0 or greater |
getSelectionStart
fun getSelectionStart(): Int
Returns the text offset of the start of the selection in the surrounding text.
A selection is the current range of the text that is selected by the user, or the current position of the cursor. A cursor is a selection where the start and end are at the same offset.
Return | |
---|---|
Int |
Value is 0 or greater |
getText
fun getText(): CharSequence
Returns the surrounding text around the cursor.
Return | |
---|---|
CharSequence |
This value cannot be null . |
writeToParcel
fun writeToParcel(
out: Parcel,
flags: Int
): Unit
Flatten this object in to a Parcel.
Parameters | |
---|---|
dest |
The Parcel in which the object should be written. This value cannot be null . |
flags |
Int: Additional flags about how the object should be written. May be 0 or PARCELABLE_WRITE_RETURN_VALUE . Value is either 0 or a combination of android.os.Parcelable#PARCELABLE_WRITE_RETURN_VALUE , and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES |
out |
Parcel: This value cannot be null . |