to top
Android APIs
public class

EditorInfo

extends Object
implements Parcelable InputType
java.lang.Object
   ↳ android.view.inputmethod.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.

Summary

Constants
int IME_ACTION_DONE Bits of IME_MASK_ACTION: the action key performs a "done" operation, typically meaning the IME will be closed.
int IME_ACTION_GO Bits of IME_MASK_ACTION: the action key performs a "go" operation to take the user to the target of the text they typed.
int IME_ACTION_NEXT Bits of IME_MASK_ACTION: the action key performs a "next" operation, taking the user to the next field that will accept text.
int IME_ACTION_NONE Bits of IME_MASK_ACTION: there is no available action.
int IME_ACTION_PREVIOUS Bits of IME_MASK_ACTION: Like IME_ACTION_NEXT, but for moving to the previous field.
int IME_ACTION_SEARCH Bits of IME_MASK_ACTION: the action key performs a "search" operation, taking the user to the results of searching for the text the have typed (in whatever context is appropriate).
int IME_ACTION_SEND Bits of IME_MASK_ACTION: the action key performs a "send" operation, delivering the text to its target.
int IME_ACTION_UNSPECIFIED 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.
int IME_FLAG_FORCE_ASCII Flag of imeOptions: used to request that the IME is capable of inputting ASCII characters.
int IME_FLAG_NAVIGATE_NEXT Flag of imeOptions: used to specify that there is something interesting that a forward navigation can focus on.
int IME_FLAG_NAVIGATE_PREVIOUS Flag of imeOptions: like IME_FLAG_NAVIGATE_NEXT, but specifies there is something interesting that a backward navigation can focus on.
int IME_FLAG_NO_ACCESSORY_ACTION Flag of imeOptions: used in conjunction with IME_MASK_ACTION, this indicates that the action should not be available as an accessory button when the input method is full-screen.
int IME_FLAG_NO_ENTER_ACTION Flag of imeOptions: used in conjunction with IME_MASK_ACTION, this indicates that the action should not be available in-line as a replacement for "enter" key.
int IME_FLAG_NO_EXTRACT_UI Flag of imeOptions: used to specify that the IME does not need to show its extracted text UI.
int IME_FLAG_NO_FULLSCREEN Flag of imeOptions: used to request that the IME never go into fullscreen mode.
int IME_MASK_ACTION Set of bits in imeOptions that provide alternative actions associated with the "enter" key.
int IME_NULL Generic unspecified type for imeOptions.
[Expand]
Inherited Constants
From interface android.os.Parcelable
From interface android.text.InputType
Fields
public static final Creator<EditorInfo> CREATOR Used to make this class parcelable.
public int actionId 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().
public CharSequence actionLabel 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.
public Bundle extras Any extra data to supply to the input method.
public int fieldId Identifier for the editor's field.
public String fieldName Additional name for the editor's field.
public CharSequence hintText The "hint" text of the text view, typically shown in-line when the text is empty to tell the user what to enter.
public int imeOptions Extended type information for the editor, to help the IME better integrate with it.
public int initialCapsMode The capitalization mode of the first character being edited in the text.
public int initialSelEnd The text offset of the end of the selection at the time editing began; -1 if not known.
public int initialSelStart The text offset of the start of the selection at the time editing began; -1 if not known.
public int inputType The content type of the text box, whose bits are defined by InputType.
public CharSequence label A label to show to the user describing the text they are writing.
public String packageName Name of the package that owns this editor.
public String privateImeOptions A string supplying additional information options that are private to a particular IME implementation.
Public Constructors
EditorInfo()
Public Methods
int describeContents()
Describe the kinds of special objects contained in this Parcelable's marshalled representation.
void dump(Printer pw, String prefix)
Write debug output of this object.
final void makeCompatible(int targetSdkVersion)
Ensure that the data in this EditorInfo is compatible with an application that was developed against the given target API version.
void writeToParcel(Parcel dest, int flags)
Used to package this object into a Parcel.
[Expand]
Inherited Methods
From class java.lang.Object
From interface android.os.Parcelable

Constants

public static final int IME_ACTION_DONE

Added in API level 3

Bits of IME_MASK_ACTION: the action key performs a "done" operation, typically meaning the IME will be closed.

Constant Value: 6 (0x00000006)

public static final int IME_ACTION_GO

Added in API level 3

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.

Constant Value: 2 (0x00000002)

public static final int IME_ACTION_NEXT

Added in API level 3

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

Constant Value: 5 (0x00000005)

public static final int IME_ACTION_NONE

Added in API level 3

Bits of IME_MASK_ACTION: there is no available action.

Constant Value: 1 (0x00000001)

public static final int IME_ACTION_PREVIOUS

Added in API level 11

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.

Constant Value: 7 (0x00000007)

public static final int IME_ACTION_SEARCH

Added in API level 3

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

Constant Value: 3 (0x00000003)

public static final int IME_ACTION_SEND

Added in API level 3

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.

Constant Value: 4 (0x00000004)

public static final int IME_ACTION_UNSPECIFIED

Added in API level 3

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.

Constant Value: 0 (0x00000000)

public static final int IME_FLAG_FORCE_ASCII

Added in API level 16

Flag of imeOptions: used to request that the IME 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 used for, typically, account ID or password input. It is expected that IMEs normally are able to input ASCII even without being told so (such IMEs already respect this flag in a sense), but there could be some cases they aren't when, for instance, only non-ASCII input languagaes like Arabic, Greek, Hebrew, Russian are enabled in the IME. Applications need to be aware that the flag is not a guarantee, and not all IMEs will respect it. However, it is strongly recommended for IME authors to respect this flag especially when their IME could end up with a state that has only non-ASCII input languages enabled.

Constant Value: -2147483648 (0x80000000)

public static final int IME_FLAG_NAVIGATE_NEXT

Added in API level 11

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

Constant Value: 134217728 (0x08000000)

public static final int IME_FLAG_NAVIGATE_PREVIOUS

Added in API level 11

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

Constant Value: 67108864 (0x04000000)

public static final int IME_FLAG_NO_ACCESSORY_ACTION

Added in API level 3

Flag of imeOptions: used in conjunction with IME_MASK_ACTION, this indicates that the action should not be available as an accessory button 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 showing text being edited is more important than the action you have supplied.

Constant Value: 536870912 (0x20000000)

public static final int IME_FLAG_NO_ENTER_ACTION

Added in API level 3

Flag of imeOptions: used in conjunction with IME_MASK_ACTION, this indicates that the action should not be available in-line as a replacement for "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

Added in API level 3

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. Though there will likely be limited access to the application available from the user, it can make the experience of a (mostly) fullscreen IME less jarring. Note that when this flag is specified the IME may not be set up to be able to display text, so it should only be used in situations where this is not needed.

Constant Value: 268435456 (0x10000000)

public static final int IME_FLAG_NO_FULLSCREEN

Added in API level 11

Flag of imeOptions: used to request that the IME never go into fullscreen mode. Applications need to be aware that the flag is not a guarantee, and not all IMEs will respect it.

Constant Value: 33554432 (0x02000000)

public static final int IME_MASK_ACTION

Added in API level 3

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.

Constant Value: 255 (0x000000ff)

public static final int IME_NULL

Added in API level 3

Generic unspecified type for imeOptions.

Constant Value: 0 (0x00000000)

Fields

public static final Creator<EditorInfo> CREATOR

Added in API level 3

Used to make this class parcelable.

public int actionId

Added in API level 3

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

public CharSequence actionLabel

Added in API level 3

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. You can not count on this being used.

public Bundle extras

Added in API level 3

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 is can be filled in from the editorExtras attribute of a TextView.

public int fieldId

Added in API level 3

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.

public String fieldName

Added in API level 3

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.

public CharSequence hintText

Added in API level 3

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

public int imeOptions

Added in API level 3

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

public int initialCapsMode

Added in API level 3

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.

public int initialSelEnd

Added in API level 3

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

public int initialSelStart

Added in API level 3

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

public int inputType

Added in API level 3

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

public CharSequence label

Added in API level 3

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

public String packageName

Added in API level 3

Name of the package that owns this editor.

public String privateImeOptions

Added in API level 3

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.

Public Constructors

public EditorInfo ()

Added in API level 3

Public Methods

public int describeContents ()

Added in API level 3

Describe the kinds of special objects contained in this Parcelable's marshalled representation.

Returns
  • a bitmask indicating the set of special object types marshalled by the Parcelable.

public void dump (Printer pw, String prefix)

Added in API level 3

Write debug output of this object.

public final void makeCompatible (int targetSdkVersion)

Added in API level 11

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: TYPE_TEXT_VARIATION_WEB_EMAIL_ADDRESS, TYPE_TEXT_VARIATION_WEB_PASSWORD, TYPE_NUMBER_VARIATION_NORMAL, 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 The API version number that the compatible application was developed against.

public void writeToParcel (Parcel dest, int flags)

Added in API level 3

Used to package this object into a Parcel.

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