Added in API level 3

EditorInfo

open class EditorInfo : InputType, Parcelable
kotlin.Any
   ↳ android.view.inputmethod.EditorInfo

An EditorInfo describes several attributes of a text editing object that an input method is communicating with (typically an EditText), most importantly the type of text content it contains and the current cursor position.

Summary

Constants
static Int

Bits of IME_MASK_ACTION: the action key performs a "done" operation, typically meaning there is nothing more to input and the IME will be closed.

static Int

Bits of IME_MASK_ACTION: the action key performs a "go" operation to take the user to the target of the text they typed.

static Int

Bits of IME_MASK_ACTION: the action key performs a "next" operation, taking the user to the next field that will accept text.

static Int

Bits of IME_MASK_ACTION: there is no available action.

static Int

Bits of IME_MASK_ACTION: like IME_ACTION_NEXT, but for moving to the previous field.

static Int

Bits of IME_MASK_ACTION: the action key performs a "search" operation, taking the user to the results of searching for the text they have typed (in whatever context is appropriate).

static Int

Bits of IME_MASK_ACTION: the action key performs a "send" operation, delivering the text to its target.

static Int

Bits of IME_MASK_ACTION: no specific action has been associated with this editor, let the editor come up with its own if it can.

static Int

Flag of imeOptions: used to request an IME that is capable of inputting ASCII characters.

static Int

Flag of imeOptions: used to specify that there is something interesting that a forward navigation can focus on.

static Int

Flag of imeOptions: like IME_FLAG_NAVIGATE_NEXT, but specifies there is something interesting that a backward navigation can focus on.

static Int

Flag of imeOptions: used in conjunction with one of the actions masked by IME_MASK_ACTION, this indicates that the action should not be available as an accessory button on the right of the extracted text when the input method is full-screen.

static Int

Flag of imeOptions: used in conjunction with one of the actions masked by IME_MASK_ACTION.

static Int

Flag of imeOptions: used to specify that the IME does not need to show its extracted text UI.

static Int

Flag of imeOptions: used to request that the IME never go into fullscreen mode.

static Int

Flag of imeOptions: used to request that the IME should not update any personalized data such as typing history and personalized language model based on what the user typed on this text editing object.

static Int

Set of bits in imeOptions that provide alternative actions associated with the "enter" key.

static Int

Generic unspecified type for imeOptions.

Inherited constants
Public constructors

Public methods
open Int

open Unit
dump(pw: Printer!, prefix: String!)

Write debug output of this object.

open CharSequence?

Gets the selected text, if any.

open SurroundingText?
getInitialSurroundingText(beforeLength: Int, afterLength: Int, flags: Int)

Gets the surrounding text around the current cursor, with beforeLength characters of text before the cursor (start of the selection), afterLength characters of text after the cursor (end of the selection), and all of the selected text.

open CharSequence?
getInitialTextAfterCursor(length: Int, flags: Int)

Get length characters of text after the current cursor position.

open CharSequence?

Get length characters of text before the current cursor position.

open Int

Returns the initial MotionEvent#ACTION_UP tool type MotionEvent#getToolType(int) responsible for focus on the current editor.

open MutableSet<Class<out PreviewableHandwritingGesture!>!>

Returns the combination of Stylus handwriting gesture preview types supported by the current Editor.

open MutableList<Class<out HandwritingGesture!>!>

Returns the combination of Stylus handwriting gesture types supported by the current Editor.

Unit
makeCompatible(targetSdkVersion: Int)

Ensure that the data in this EditorInfo is compatible with an application that was developed against the given target API version.

open Unit
setInitialSurroundingSubText(subText: CharSequence, subTextStart: Int)

Editors may use this method to provide initial input text to IMEs.

open Unit

Editors may use this method to provide initial input text to IMEs.

open Unit

Set the initial MotionEvent#ACTION_UP tool type MotionEvent#getToolType(int).

open Unit

Set the Handwriting gesture previews supported by the current Editor.

open Unit

Set the Handwriting gestures supported by the current Editor.

open Unit
writeToParcel(dest: Parcel, flags: Int)

Used to package this object into a Parcel.

Properties
static Parcelable.Creator<EditorInfo!>

Used to make this class parcelable.

Int

If actionLabel has been given, this is the id for that command when the user presses its button that is delivered back with InputConnection.performEditorAction().

CharSequence!

In some cases an IME may be able to display an arbitrary label for a command the user can perform, which you can specify here.

Array<String!>?

List of acceptable MIME types for InputConnection#commitContent(InputContentInfo, int, Bundle).

Bundle!

Any extra data to supply to the input method.

Int

Identifier for the editor's field.

String!

Additional name for the editor's field.

LocaleList?

List of the languages that the user is supposed to switch to no matter what input method subtype is currently used.

CharSequence!

The "hint" text of the text view, typically shown in-line when the text is empty to tell the user what to enter.

Int

Extended type information for the editor, to help the IME better integrate with it.

Int

The capitalization mode of the first character being edited in the text.

Int

The text offset of the end of the selection at the time editing begins; -1 if not known.

Int

The text offset of the start of the selection at the time editing begins; -1 if not known.

Int

The content type of the text box, whose bits are defined by InputType.

CharSequence!

A label to show to the user describing the text they are writing.

String!

Name of the package that owns this editor.

String!

A string supplying additional information options that are private to a particular IME implementation.

Constants

IME_ACTION_DONE

Added in API level 3
static val IME_ACTION_DONE: Int

Bits of IME_MASK_ACTION: the action key performs a "done" operation, typically meaning there is nothing more to input and the IME will be closed.

Value: 6

IME_ACTION_GO

Added in API level 3
static val IME_ACTION_GO: Int

Bits of IME_MASK_ACTION: the action key performs a "go" operation to take the user to the target of the text they typed. Typically used, for example, when entering a URL.

Value: 2

IME_ACTION_NEXT

Added in API level 3
static val IME_ACTION_NEXT: Int

Bits of IME_MASK_ACTION: the action key performs a "next" operation, taking the user to the next field that will accept text.

Value: 5

IME_ACTION_NONE

Added in API level 3
static val IME_ACTION_NONE: Int

Bits of IME_MASK_ACTION: there is no available action.

Value: 1

IME_ACTION_PREVIOUS

Added in API level 11
static val IME_ACTION_PREVIOUS: Int

Bits of IME_MASK_ACTION: like IME_ACTION_NEXT, but for moving to the previous field. This will normally not be used to specify an action (since it precludes IME_ACTION_NEXT), but can be returned to the app if it sets IME_FLAG_NAVIGATE_PREVIOUS.

Value: 7
Added in API level 3
static val IME_ACTION_SEARCH: Int

Bits of IME_MASK_ACTION: the action key performs a "search" operation, taking the user to the results of searching for the text they have typed (in whatever context is appropriate).

Value: 3

IME_ACTION_SEND

Added in API level 3
static val IME_ACTION_SEND: Int

Bits of IME_MASK_ACTION: the action key performs a "send" operation, delivering the text to its target. This is typically used when composing a message in IM or SMS where sending is immediate.

Value: 4

IME_ACTION_UNSPECIFIED

Added in API level 3
static val IME_ACTION_UNSPECIFIED: Int

Bits of IME_MASK_ACTION: no specific action has been associated with this editor, let the editor come up with its own if it can.

Value: 0

IME_FLAG_FORCE_ASCII

Added in API level 16
static val IME_FLAG_FORCE_ASCII: Int

Flag of imeOptions: used to request an IME that is capable of inputting ASCII characters. The intention of this flag is to ensure that the user can type Roman alphabet characters in a android.widget.TextView. It is typically used for an account ID or password input. A lot of the time, IMEs are already able to input ASCII even without being told so (such IMEs already respect this flag in a sense), but there are cases when this is not the default. For instance, users of languages using a different script like Arabic, Greek, Hebrew or Russian typically have a keyboard that can't input ASCII characters by default. Applications need to be aware that the flag is not a guarantee, and some IMEs may not respect it. However, it is strongly recommended for IME authors to respect this flag especially when their IME could end up with a state where only languages using non-ASCII are enabled.

Value: -2147483648

IME_FLAG_NAVIGATE_NEXT

Added in API level 11
static val IME_FLAG_NAVIGATE_NEXT: Int

Flag of imeOptions: used to specify that there is something interesting that a forward navigation can focus on. This is like using IME_ACTION_NEXT, except allows the IME to be multiline (with an enter key) as well as provide forward navigation. Note that some IMEs may not be able to do this, especially when running on a small screen where there is little space. In that case it does not need to present a UI for this option. Like IME_ACTION_NEXT, if the user selects the IME's facility to forward navigate, this will show up in the application at InputConnection.performEditorAction(int).

Value: 134217728

IME_FLAG_NAVIGATE_PREVIOUS

Added in API level 11
static val IME_FLAG_NAVIGATE_PREVIOUS: Int

Flag of imeOptions: like IME_FLAG_NAVIGATE_NEXT, but specifies there is something interesting that a backward navigation can focus on. If the user selects the IME's facility to backward navigate, this will show up in the application as an IME_ACTION_PREVIOUS at InputConnection.performEditorAction(int).

Value: 67108864

IME_FLAG_NO_ACCESSORY_ACTION

Added in API level 3
static val IME_FLAG_NO_ACCESSORY_ACTION: Int

Flag of imeOptions: used in conjunction with one of the actions masked by IME_MASK_ACTION, this indicates that the action should not be available as an accessory button on the right of the extracted text when the input method is full-screen. Note that by setting this flag, there can be cases where the action is simply never available to the user. Setting this generally means that you think that in fullscreen mode, where there is little space to show the text, it's not worth taking some screen real estate to display the action and it should be used instead to show more text.

Value: 536870912

IME_FLAG_NO_ENTER_ACTION

Added in API level 3
static val IME_FLAG_NO_ENTER_ACTION: Int

Flag of imeOptions: used in conjunction with one of the actions masked by IME_MASK_ACTION. If this flag is not set, IMEs will normally replace the "enter" key with the action supplied. This flag indicates that the action should not be available in-line as a replacement for the "enter" key. Typically this is because the action has such a significant impact or is not recoverable enough that accidentally hitting it should be avoided, such as sending a message. Note that android.widget.TextView will automatically set this flag for you on multi-line text views.

Value: 1073741824

IME_FLAG_NO_EXTRACT_UI

Added in API level 3
static val IME_FLAG_NO_EXTRACT_UI: Int

Flag of imeOptions: used to specify that the IME does not need to show its extracted text UI. For input methods that may be fullscreen, often when in landscape mode, this allows them to be smaller and let part of the application be shown behind, through transparent UI parts in the fullscreen IME. The part of the UI visible to the user may not be responsive to touch because the IME will receive touch events, which may confuse the user; use IME_FLAG_NO_FULLSCREEN instead for a better experience. Using this flag is discouraged and it may become deprecated in the future. Its meaning is unclear in some situations and it may not work appropriately on older versions of the platform.

Value: 268435456

IME_FLAG_NO_FULLSCREEN

Added in API level 11
static val IME_FLAG_NO_FULLSCREEN: Int

Flag of imeOptions: used to request that the IME never go into fullscreen mode. By default, IMEs may go into full screen mode when they think it's appropriate, for example on small screens in landscape orientation where displaying a software keyboard may occlude such a large portion of the screen that the remaining part is too small to meaningfully display the application UI. If this flag is set, compliant IMEs will never go into full screen mode, and always leave some space to display the application UI. Applications need to be aware that the flag is not a guarantee, and some IMEs may ignore it.

Value: 33554432

IME_FLAG_NO_PERSONALIZED_LEARNING

Added in API level 26
static val IME_FLAG_NO_PERSONALIZED_LEARNING: Int

Flag of imeOptions: used to request that the IME should not update any personalized data such as typing history and personalized language model based on what the user typed on this text editing object. Typical use cases are:

  • When the application is in a special mode, where user's activities are expected to be not recorded in the application's history. Some web browsers and chat applications may have this kind of modes.
  • When storing typing history does not make much sense. Specifying this flag in typing games may help to avoid typing history from being filled up with words that the user is less likely to type in their daily life. Another example is that when the application already knows that the expected input is not a valid word (e.g. a promotion code that is not a valid word in any natural language).

Applications need to be aware that the flag is not a guarantee, and some IMEs may not respect it.

Value: 16777216

IME_MASK_ACTION

Added in API level 3
static val IME_MASK_ACTION: Int

Set of bits in imeOptions that provide alternative actions associated with the "enter" key. This both helps the IME provide better feedback about what the enter key will do, and also allows it to provide alternative mechanisms for providing that command.

Value: 255

IME_NULL

Added in API level 3
static val IME_NULL: Int

Generic unspecified type for imeOptions.

Value: 0

Public constructors

EditorInfo

EditorInfo()

Public methods

describeContents

Added in API level 3
open 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

dump

Added in API level 3
open fun dump(
    pw: Printer!,
    prefix: String!
): Unit

Write debug output of this object.

getInitialSelectedText

Added in API level 30
open fun getInitialSelectedText(flags: Int): CharSequence?

Gets the selected text, if any. May be null when the protocol is not supported or the selected text is way too long.

Parameters
flags Int: Supplies additional options controlling how the text is returned. May be either 0 or InputConnection#GET_TEXT_WITH_STYLES. Value is either 0 or android.view.inputmethod.InputConnection#GET_TEXT_WITH_STYLES
Return
CharSequence? the text that is currently selected, if any. It could be an empty string when there is no text selected. When null is returned, the selected text might be too long or this protocol is not supported.

getInitialSurroundingText

Added in API level 31
open fun getInitialSurroundingText(
    beforeLength: Int,
    afterLength: Int,
    flags: Int
): SurroundingText?

Gets the surrounding text around the current cursor, with beforeLength characters of text before the cursor (start of the selection), afterLength characters of text after the cursor (end of the selection), and all of the selected text.

The initial surrounding text for return could be trimmed if oversize. Fundamental trimming rules are:

  • The text before the cursor is the most important information to IMEs.
  • The text after the cursor is the second important information to IMEs.
  • The selected text is the least important information but it shall NEVER be truncated. When it is too long, just drop it.

For example, the subText can be viewed as TextBeforeCursor + Selection + TextAfterCursor. The result could be:

  1. (maybeTrimmedAtHead)TextBeforeCursor + Selection + TextAfterCursor(maybeTrimmedAtTail)
  2. (maybeTrimmedAtHead)TextBeforeCursor + TextAfterCursor(maybeTrimmedAtTail)
Parameters
beforeLength Int: The expected length of the text before the cursor. Value is 0 or greater
afterLength Int: The expected length of the text after the cursor. Value is 0 or greater
flags Int: Supplies additional options controlling how the text is returned. May be either 0 or InputConnection#GET_TEXT_WITH_STYLES. Value is either 0 or android.view.inputmethod.InputConnection#GET_TEXT_WITH_STYLES
Return
SurroundingText? an android.view.inputmethod.SurroundingText object describing the surrounding text and state of selection, or null if the editor or system could not support this protocol.
Exceptions
java.lang.IllegalArgumentException if beforeLength or afterLength is negative.

getInitialTextAfterCursor

Added in API level 30
open fun getInitialTextAfterCursor(
    length: Int,
    flags: Int
): CharSequence?

Get length characters of text after the current cursor position. May be null when the protocol is not supported.

Parameters
length Int: The expected length of the text. Value is 0 or greater
flags Int: Supplies additional options controlling how the text is returned. May be either 0 or InputConnection#GET_TEXT_WITH_STYLES. Value is either 0 or android.view.inputmethod.InputConnection#GET_TEXT_WITH_STYLES
Return
CharSequence? the text after the cursor position; the length of the returned text might be less than length. When there is no text after the cursor, an empty string will be returned. It could also be null when the editor or system could not support this protocol.

getInitialTextBeforeCursor

Added in API level 30
open fun getInitialTextBeforeCursor(
    length: Int,
    flags: Int
): CharSequence?

Get length characters of text before the current cursor position. May be null when the protocol is not supported.

Parameters
length Int: The expected length of the text. Value is 0 or greater
flags Int: Supplies additional options controlling how the text is returned. May be either 0 or InputConnection#GET_TEXT_WITH_STYLES. Value is either 0 or android.view.inputmethod.InputConnection#GET_TEXT_WITH_STYLES
Return
CharSequence? the text before the cursor position; the length of the returned text might be less than length. When there is no text before the cursor, an empty string will be returned. It could also be null when the editor or system could not support this protocol.

getSupportedHandwritingGesturePreviews

Added in API level 34
open fun getSupportedHandwritingGesturePreviews(): MutableSet<Class<out PreviewableHandwritingGesture!>!>

Returns the combination of Stylus handwriting gesture preview types supported by the current Editor. For an editor that supports Stylus Handwriting. InputMethodManager#startStylusHandwriting, it also declares supported gesture previews.

Note: A supported gesture EditorInfo#getSupportedHandwritingGestures() may not have preview supported EditorInfo#getSupportedHandwritingGesturePreviews().

Return
MutableSet<Class<out PreviewableHandwritingGesture!>!> Set of supported gesture preview classes. One of SelectGesture, SelectRangeGesture, DeleteGesture, DeleteRangeGesture. This value cannot be null.

getSupportedHandwritingGestures

Added in API level 34
open fun getSupportedHandwritingGestures(): MutableList<Class<out HandwritingGesture!>!>

Returns the combination of Stylus handwriting gesture types supported by the current Editor. For an editor that supports Stylus Handwriting. InputMethodManager#startStylusHandwriting, it also declares supported gestures.

Return
MutableList<Class<out HandwritingGesture!>!> List of supported gesture classes including any of SelectGesture, InsertGesture, DeleteGesture. This value cannot be null.

makeCompatible

Added in API level 11
fun makeCompatible(targetSdkVersion: Int): Unit

Ensure that the data in this EditorInfo is compatible with an application that was developed against the given target API version. This can impact the following input types: InputType#TYPE_TEXT_VARIATION_WEB_EMAIL_ADDRESS, InputType#TYPE_TEXT_VARIATION_WEB_PASSWORD, InputType#TYPE_NUMBER_VARIATION_NORMAL, InputType#TYPE_NUMBER_VARIATION_PASSWORD.

This is called by the framework for input method implementations; you should not generally need to call it yourself.

Parameters
targetSdkVersion Int: The API version number that the compatible application was developed against.

setInitialSurroundingSubText

Added in API level 30
open fun setInitialSurroundingSubText(
    subText: CharSequence,
    subTextStart: Int
): Unit

Editors may use this method to provide initial input text to IMEs. As the surrounding text could be used to provide various input assistance, we recommend editors to provide the complete initial input text in its View#onCreateInputConnection(EditorInfo) callback. When trimming the input text is needed, call this method instead of setInitialSurroundingText(CharSequence) and provide the trimmed position info. Always try to include the selected text within subText to give the system best flexibility to choose where and how to trim subText when necessary. Starting from VERSION_CODES#S, spans that do not implement Parcelable will be automatically dropped.

Parameters
subText CharSequence: The input text. When it was trimmed, subTextStart must be provided correctly. This value cannot be null.
subTextStart Int: The position that the input text got trimmed. For example, when the editor wants to trim out the first 10 chars, subTextStart should be 10.

setInitialSurroundingText

Added in API level 30
open fun setInitialSurroundingText(sourceText: CharSequence): Unit

Editors may use this method to provide initial input text to IMEs. As the surrounding text could be used to provide various input assistance, we recommend editors to provide the complete initial input text in its View#onCreateInputConnection(EditorInfo) callback. The supplied text will then be processed to serve getInitialTextBeforeCursor, getInitialSelectedText, and getInitialTextBeforeCursor. System is allowed to trim sourceText for various reasons while keeping the most valuable data to IMEs. Starting from VERSION_CODES#S, spans that do not implement Parcelable will be automatically dropped.

Editor authors: Providing the initial input text helps reducing IPC calls for IMEs to provide many modern features right after the connection setup. We recommend calling this method in your implementation.

Parameters
sourceText CharSequence: The complete input text. This value cannot be null.

setSupportedHandwritingGesturePreviews

Added in API level 34
open fun setSupportedHandwritingGesturePreviews(gestures: MutableSet<Class<out PreviewableHandwritingGesture!>!>): Unit

Set the Handwriting gesture previews supported by the current Editor. For an editor that supports Stylus Handwriting InputMethodManager#startStylusHandwriting, it is also recommended that it declares supported gesture previews.

Note: A supported gesture EditorInfo#getSupportedHandwritingGestures() may not have preview supported EditorInfo#getSupportedHandwritingGesturePreviews().

If editor doesn't support one of the declared types, gesture preview will be ignored.

Parameters
gestures MutableSet<Class<out PreviewableHandwritingGesture!>!>: Set of supported gesture classes. One of SelectGesture, SelectRangeGesture, DeleteGesture, DeleteRangeGesture. This value cannot be null.

setSupportedHandwritingGestures

Added in API level 34
open fun setSupportedHandwritingGestures(gestures: MutableList<Class<out HandwritingGesture!>!>): Unit

Set the Handwriting gestures supported by the current Editor. For an editor that supports Stylus Handwriting InputMethodManager#startStylusHandwriting, it is also recommended that it declares supported gestures.

If editor doesn't support one of the declared types, IME will not send those Gestures to the editor. Instead they will fallback to using normal text input.

Note: A supported gesture may not have preview supported getSupportedHandwritingGesturePreviews().

Parameters
gestures MutableList<Class<out HandwritingGesture!>!>: List of supported gesture classes including any of SelectGesture, InsertGesture, DeleteGesture. This value cannot be null.

writeToParcel

Added in API level 3
open fun writeToParcel(
    dest: Parcel,
    flags: Int
): Unit

Used to package this object into a Parcel.

Parameters
dest Parcel: The Parcel to be written.
flags Int: The flags used for parceling.

Properties

CREATOR

Added in API level 3
static val CREATOR: Parcelable.Creator<EditorInfo!>

Used to make this class parcelable.

actionId

Added in API level 3
var actionId: Int

If actionLabel has been given, this is the id for that command when the user presses its button that is delivered back with InputConnection.performEditorAction().

actionLabel

Added in API level 3
var actionLabel: CharSequence!

In some cases an IME may be able to display an arbitrary label for a command the user can perform, which you can specify here. This is typically used as the label for the action to use in-line as a replacement for the "enter" key (see actionId). Remember the key where this will be displayed is typically very small, and there are significant localization challenges to make this fit in all supported languages. Also you can not count absolutely on this being used, as some IMEs may ignore this.

contentMimeTypes

Added in API level 25
var contentMimeTypes: Array<String!>?

List of acceptable MIME types for InputConnection#commitContent(InputContentInfo, int, Bundle).

null or an empty array means that InputConnection#commitContent(InputContentInfo, int, Bundle) is not supported in this editor.

extras

Added in API level 3
var extras: Bundle!

Any extra data to supply to the input method. This is for extended communication with specific input methods; the name fields in the bundle should be scoped (such as "com.mydomain.im.SOME_FIELD") so that they don't conflict with others. This field can be filled in from the android.R.attr#editorExtras attribute of a TextView.

fieldId

Added in API level 3
var fieldId: Int

Identifier for the editor's field. This is optional, and may be 0. By default it is filled in with the result of View.getId() on the View that is being edited.

fieldName

Added in API level 3
var fieldName: String!

Additional name for the editor's field. This can supply additional name information for the field. By default it is null. The actual contents have no meaning.

hintLocales

Added in API level 24
var hintLocales: LocaleList?

List of the languages that the user is supposed to switch to no matter what input method subtype is currently used. This special "hint" can be used mainly for, but not limited to, multilingual users who want IMEs to switch language context automatically.

null means that no special language "hint" is needed.

Editor authors: Specify this only when you are confident that the user will switch to certain languages in this context no matter what input method subtype is currently selected. Otherwise, keep this null. Explicit user actions and/or preferences would be good signals to specify this special "hint", For example, a chat application may be able to put the last used language at the top of hintLocales based on whom the user is going to talk, by remembering what language is used in the last conversation. Do not specify android.widget.TextView#getTextLocales() only because it is used for text rendering.

hintText

Added in API level 3
var hintText: CharSequence!

The "hint" text of the text view, typically shown in-line when the text is empty to tell the user what to enter.

imeOptions

Added in API level 3
var imeOptions: Int

Extended type information for the editor, to help the IME better integrate with it.

initialCapsMode

Added in API level 3
var initialCapsMode: Int

The capitalization mode of the first character being edited in the text. Values may be any combination of TextUtils.CAP_MODE_CHARACTERS, TextUtils.CAP_MODE_WORDS, and TextUtils.CAP_MODE_SENTENCES, though you should generally just take a non-zero value to mean "start out in caps mode".

initialSelEnd

Added in API level 3
var initialSelEnd: Int

The text offset of the end of the selection at the time editing begins; -1 if not known. Keep in mind that, without knowing the cursor position, many IMEs will not be able to offer their full feature set and may behave in unpredictable ways: pass the actual cursor position here if possible at all.

Also, this needs to be the cursor position right now, not at some point in the past, even if input is starting in the same text field as before. When the app is filling this object, input is about to start by definition, and this value will override any value the app may have passed to InputMethodManager#updateSelection(android.view.View, int, int, int, int) before.

initialSelStart

Added in API level 3
var initialSelStart: Int

The text offset of the start of the selection at the time editing begins; -1 if not known. Keep in mind that, without knowing the cursor position, many IMEs will not be able to offer their full feature set and may even behave in unpredictable ways: pass the actual cursor position here if possible at all.

Also, this needs to be the cursor position right now, not at some point in the past, even if input is starting in the same text field as before. When the app is filling this object, input is about to start by definition, and this value will override any value the app may have passed to InputMethodManager#updateSelection(android.view.View, int, int, int, int) before.

inputType

Added in API level 3
var inputType: Int

The content type of the text box, whose bits are defined by InputType.

label

Added in API level 3
var label: CharSequence!

A label to show to the user describing the text they are writing.

packageName

Added in API level 3
var packageName: String!

Name of the package that owns this editor.

IME authors: In API level 22 android.os.Build.VERSION_CODES#LOLLIPOP_MR1 and prior, do not trust this package name. The system had not verified the consistency between the package name here and application's uid. Consider to use InputBinding#getUid(), which is trustworthy. Starting from android.os.Build.VERSION_CODES#M, the system verifies the consistency between this package name and application uid before EditorInfo is passed to the input method.

Editor authors: Starting from android.os.Build.VERSION_CODES#M, the application is no longer able to establish input connections if the package name provided here is inconsistent with application's uid.

privateImeOptions

Added in API level 3
var privateImeOptions: String!

A string supplying additional information options that are private to a particular IME implementation. The string must be scoped to a package owned by the implementation, to ensure there are no conflicts between implementations, but other than that you can put whatever you want in it to communicate with the IME. For example, you could have a string that supplies an argument like "com.example.myapp.SpecialMode=3". This field is can be filled in from the android.R.attr#privateImeOptions attribute of a TextView.