EditorInfo

Class Overview

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.

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.

Flag for TYPE_CLASS_TEXT: the text editor (which means
the application) is performing auto-completion of the text being entered
based on its own semantics, which it will present to the user as they type.

Flag for use with writeToParcel(Parcel, int): the object being written
is a return value, that is the result of a function such as
"Parcelable someFunction()",
"void someFunction(out Parcelable)", or
"void someFunction(inout Parcelable)".

public
static
final
int
IME_FLAG_FORCE_ASCII

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 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.

Constant Value:
-2147483648
(0x80000000)

public
static
final
int
IME_FLAG_NAVIGATE_NEXT

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).

public
static
final
int
IME_FLAG_NO_ACCESSORY_ACTION

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.

Constant Value:
536870912
(0x20000000)

public
static
final
int
IME_FLAG_NO_ENTER_ACTION

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
TextView will automatically set this flag for you
on multi-line text views.

Constant Value:
1073741824
(0x40000000)

public
static
final
int
IME_FLAG_NO_EXTRACT_UI

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.

Constant Value:
268435456
(0x10000000)

public
static
final
int
IME_FLAG_NO_FULLSCREEN

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.

Constant Value:
33554432
(0x02000000)

public
static
final
int
IME_MASK_ACTION

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.

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.

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 editorExtras
attribute of a TextView.

public
int
initialSelEnd

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
updateSelection(android.view.View, int, int, int, int)
before.

public
int
initialSelStart

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
updateSelection(android.view.View, int, int, int, int)
before.

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 privateImeOptions
attribute of a TextView.