Added in API level 33
TextSnapshot
class TextSnapshot
kotlin.Any | |
↳ | android.view.inputmethod.TextSnapshot |
An immutable data snapshot of text editing state.
Summary
Public constructors | |
---|---|
TextSnapshot(surroundingText: SurroundingText, compositionStart: Int, compositionEnd: Int, cursorCapsMode: Int) Creates a new instance of |
Public methods | |
---|---|
Int | |
Int | |
Int |
The capitalization mode of the first character being edited in the text. |
Int | |
Int | |
SurroundingText |
Public constructors
TextSnapshot
Added in API level 33
TextSnapshot(
surroundingText: SurroundingText,
compositionStart: Int,
compositionEnd: Int,
cursorCapsMode: Int)
Creates a new instance of TextSnapshot
Parameters | |
---|---|
surroundingText |
SurroundingText: SurroundingText of the current edit field. This value cannot be null . |
compositionStart |
Int: The start index of the composing text. -1 if there is no composing text. Value is -1 or greater |
compositionEnd |
Int: The end index of the composing text. -1 if there is no composing text. Value is -1 or greater |
cursorCapsMode |
Int: The capitalization mode of the first character being edited in the text. See EditorInfo#initialCapsMode . |
Exceptions | |
---|---|
java.lang.NullPointerException |
if surroundingText is null . |
java.lang.IllegalArgumentException |
if compositionStart and/or compositionEnd is less than -1 . |
Public methods
getCompositionEnd
Added in API level 33
fun getCompositionEnd(): Int
Return | |
---|---|
Int |
The end index of the composing text. -1 if there is no composing text. Value is -1 or greater |
getCompositionStart
Added in API level 33
fun getCompositionStart(): Int
Return | |
---|---|
Int |
The end index of the composing text. -1 if there is no composing text. Value is -1 or greater |
getCursorCapsMode
Added in API level 33
fun getCursorCapsMode(): Int
The capitalization mode of the first character being edited in the text.
Values may be any combination of the following values:
You should generally just take a non-zero value to mean "start out in caps mode" though.
getSelectionEnd
Added in API level 33
fun getSelectionEnd(): Int
Return | |
---|---|
Int |
The end index of the selection range. -1 if it is not available. Value is -1 or greater |
getSelectionStart
Added in API level 33
fun getSelectionStart(): Int
Return | |
---|---|
Int |
The start index of the selection range. -1 if it is not available. Value is -1 or greater |
getSurroundingText
Added in API level 33
fun getSurroundingText(): SurroundingText
Return | |
---|---|
SurroundingText |
SurroundingText of the current edit field. This value cannot be null . |