Added in API level 3

InputMethodInfo


class InputMethodInfo : Parcelable
kotlin.Any
   ↳ android.view.inputmethod.InputMethodInfo

This class is used to specify meta information of an input method.

It should be defined in an XML resource file with an <input-method> element. For more information, see the guide to Creating an Input Method.

Summary

XML attributes
android:configChanges Specify one or more configuration changes that the IME will handle itself.
android:isDefault Set to true in all of the configurations for which this input method should be considered an option as the default.
android:settingsActivity Component name of an activity that allows the user to modify the settings for this service.
android:showInInputMethodPicker Specifies whether the IME wants to be shown in the Input Method picker.
android:supportsInlineSuggestions Specifies whether the IME supports showing inline suggestions.
android:supportsInlineSuggestionsWithTouchExploration Specifies whether the IME supports showing inline suggestions when touch exploration is enabled.
android:supportsSwitchingToNextInputMethod Set to true if this input method supports ways to switch to a next input method (for example, a globe key.).
android:suppressesSpellChecker Specifies whether the IME suppresses system spell checker.
Constants
static String

Intent action for the IME language settings.

static String

Intent action for IME that supports stylus handwriting.

Inherited constants
Public constructors
InputMethodInfo(context: Context!, service: ResolveInfo!)

Constructor.

InputMethodInfo(packageName: String!, className: String!, label: CharSequence!, settingsActivity: String!)

Temporary API for creating a built-in input method for test.

Public methods
Intent?

Returns Intent for IME language settings activity with Intent actionACTION_IME_LANGUAGE_SETTINGS.

Intent?

Returns Intent for stylus handwriting settings activity with Intent actionACTION_STYLUS_HANDWRITING_SETTINGS if IME supports stylus handwriting, else null if there are no associated settings for stylus handwriting / handwriting is not supported or if android.R.styleable#InputMethod_stylusHandwritingSettingsActivity is not defined.

Int

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

Boolean
equals(other: Any?)

Used to test whether the given parameter object is an InputMethodInfo and its Id is the same to this one.

ComponentName!

Return the component of the service that implements this input method.

Int

Returns the bit mask of kinds of configuration changes that this IME can handle itself (without being restarted by the system).

String!

Int

Return the resource identifier of a resource inside of this input method's .

String!

Return the .

ServiceInfo!

Return the raw information about the Service implementing this input method.

String!

Return the class name of the service component that implements this input method.

String!

Return the class name of an activity that provides a settings UI for the input method.

InputMethodSubtype!
getSubtypeAt(index: Int)

Return the Input Method's subtype at the specified index.

Int

Return the count of the subtypes of Input Method.

Int

Drawable!

Load the user-displayed icon for this input method.

CharSequence!

Load the user-displayed label for this input method.

Boolean

Returns true if this input method should be shown in menus for selecting an Input Method, such as the system Input Method Picker.

Boolean

Returns whether the IME supports connectionless stylus handwriting sessions.

Boolean

Returns if IME supports handwriting using stylus input.

Boolean

Return true if this input method suppresses spell checker.

String

Unit
writeToParcel(dest: Parcel, flags: Int)

Used to package this object into a Parcel.

Properties
static Parcelable.Creator<InputMethodInfo!>

Used to make this class parcelable.

XML attributes

android:configChanges

android:configChanges
Specify one or more configuration changes that the IME will handle itself. If not specified, the IME will be restarted if any of these configuration changes happen in the system. Otherwise, the IME will remain running and its android.inputmethodservice.InputMethodService#onConfigurationChanged method is called with the new configuration.

Note that all of these configuration changes can impact the resource values seen by the application, so you will generally need to re-retrieve all resources (including view layouts, drawables, etc) to correctly handle any configuration change.

Must be one or more (separated by '|') of the following constant values.

Constant Value Description
assetsPaths 80000000 The assets paths have changed. For example a runtime overlay is installed and enabled. Corresponds to android.content.pm.ActivityInfo#CONFIG_ASSETS_PATHS.
colorMode 4000 The color mode of the screen has changed (color gamut or dynamic range).
density 1000 The display density has changed. This might be caused by the user specifying a different display scale, or it might be caused by a different display being activated.
fontScale 40000000 The font scaling factor has changed, that is the user has selected a new global font size.
fontWeightAdjustment 10000000 The font weight adjustment value has changed. Used to reflect the user increasing font weight.
grammaticalGender 8000 The grammatical gender has changed, for example the user set the grammatical gender from the UI.
keyboard 10 The keyboard type has changed, for example the user has plugged in an external keyboard.
keyboardHidden 20 The keyboard or navigation accessibility has changed, for example the user has slid the keyboard out to expose it. Note that despite its name, this applied to any accessibility: keyboard or navigation.
layoutDirection 2000 The layout direction has changed. For example going from LTR to RTL.
locale 4 The locale has changed, that is the user has selected a new language that text should be displayed in.
mcc 1 The IMSI MCC has changed, that is a SIM has been detected and updated the Mobile Country Code. By default from Android O, we don't recreate the activity even the app doesn't specify mcc in configChanges. If the app wants to recreate the activity, specify mcc in recreateOnConfigChanges.
mnc 2 The IMSI MNC has changed, that is a SIM has been detected and updated the Mobile Network Code. By default from Android O, we don't recreate the activity even the app doesn't specify mnc in configChanges. If the app wants to recreate the acvitity, specify mnc in recreateOnConfigChanges.
navigation 40 The navigation type has changed. Should never normally happen.
orientation 80 The screen orientation has changed, that is the user has rotated the device.
resourcesUnused 8000000 This is probably not the flag you want, the resources compiler supports a less dangerous version of it, 'allKnown', that only suppresses all currently existing configuration change restarts depending on your target SDK rather than whatever the latest SDK supports, allowing the application to work with resources on future Platform versions. Activity doesn't use Android Resources at all and doesn't need to be restarted on any configuration changes. This overrides all other flags, and this is recommended to be used individually. Corresponds to android.content.pm.ActivityInfo#CONFIG_RESOURCES_UNUSED.
screenLayout 100 The screen layout has changed. This might be caused by a different display being activated.
screenSize 400 The current available screen size has changed. If applications don't target at least android.os.Build.VERSION_CODES#HONEYCOMB_MR2 then the activity will always handle this itself (the change will not result in a restart). This represents a change in the currently available size, so will change when the user switches between landscape and portrait.
smallestScreenSize 800 The physical screen size has changed. If applications don't target at least android.os.Build.VERSION_CODES#HONEYCOMB_MR2 then the activity will always handle this itself (the change will not result in a restart). This represents a change in size regardless of orientation, so will only change when the actual physical screen size has changed such as switching to an external display.
touchscreen 8 The touchscreen has changed. Should never normally happen.
uiMode 200 The global user interface mode has changed. For example, going in or out of car mode, night mode changing, etc.

android:isDefault

android:isDefault
Set to true in all of the configurations for which this input method should be considered an option as the default.

May be a boolean value, such as "true" or "false".

android:settingsActivity

android:settingsActivity
Component name of an activity that allows the user to modify the settings for this service.

May be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character;

android:showInInputMethodPicker

android:showInInputMethodPicker
Specifies whether the IME wants to be shown in the Input Method picker. Defaults to true. Set this to false if the IME is intended to be accessed programmatically.

Note: This functions as a hint to the system, which may choose to ignore this preference in certain situations or in future releases.

May be a boolean value, such as "true" or "false".

android:supportsInlineSuggestions

android:supportsInlineSuggestions
Specifies whether the IME supports showing inline suggestions.

May be a boolean value, such as "true" or "false".

android:supportsInlineSuggestionsWithTouchExploration

android:supportsInlineSuggestionsWithTouchExploration
Specifies whether the IME supports showing inline suggestions when touch exploration is enabled. This does nothing if supportsInlineSuggestions is false. The default value is false and most IMEs should not set this to true since the older menu-style Autofill works better with touch exploration. This attribute should be set to true in special situations, such as if this is an accessibility-focused IME which blocks user interaction with the app window while the IME is displayed.

May be a boolean value, such as "true" or "false".

android:supportsSwitchingToNextInputMethod

android:supportsSwitchingToNextInputMethod
Set to true if this input method supports ways to switch to a next input method (for example, a globe key.). When this is true and InputMethodManager#shouldOfferSwitchingToNextInputMethod() returns true, the IME has to offer ways to invoke InputMethodManager#switchToNextInputMethod() accordingly.

Note that the system determines the most appropriate next input method and subtype in order to provide the consistent user experience in switching between IMEs and subtypes.

May be a boolean value, such as "true" or "false".

android:suppressesSpellChecker

android:suppressesSpellChecker
Specifies whether the IME suppresses system spell checker. The default value is false. If an IME sets this attribute to true, the system spell checker will be disabled while the IME has an active input session.

May be a boolean value, such as "true" or "false".

Constants

ACTION_IME_LANGUAGE_SETTINGS

static val ACTION_IME_LANGUAGE_SETTINGS: String

Intent action for the IME language settings.

Value: "android.view.inputmethod.action.IME_LANGUAGE_SETTINGS"

ACTION_STYLUS_HANDWRITING_SETTINGS

Added in API level 34
static val ACTION_STYLUS_HANDWRITING_SETTINGS: String

Intent action for IME that supports stylus handwriting.

Value: "android.view.inputmethod.action.STYLUS_HANDWRITING_SETTINGS"

Public constructors

InputMethodInfo

Added in API level 3
InputMethodInfo(
    context: Context!,
    service: ResolveInfo!)

Constructor.

Parameters
context Context!: The Context in which we are parsing the input method.
service ResolveInfo!: The ResolveInfo returned from the package manager about this input method's component.

InputMethodInfo

Added in API level 3
InputMethodInfo(
    packageName: String!,
    className: String!,
    label: CharSequence!,
    settingsActivity: String!)

Temporary API for creating a built-in input method for test.

Public methods

createImeLanguageSettingsActivityIntent

fun createImeLanguageSettingsActivityIntent(): Intent?

Returns Intent for IME language settings activity with Intent actionACTION_IME_LANGUAGE_SETTINGS. If android.R.styleable#InputMethod_languageSettingsActivity is not defined, tries to fall back to the IME general settings activity. If android.R.styleable#InputMethod_settingsActivity is also not defined, returns {code null}.

To launch IME language settings, use this method to get the Intent to launch the IME language settings activity.

e.g.

<code>startActivity(createImeLanguageSettingsActivityIntent());</code>

createStylusHandwritingSettingsActivityIntent

Added in API level 34
fun createStylusHandwritingSettingsActivityIntent(): Intent?

Returns Intent for stylus handwriting settings activity with Intent actionACTION_STYLUS_HANDWRITING_SETTINGS if IME supports stylus handwriting, else null if there are no associated settings for stylus handwriting / handwriting is not supported or if android.R.styleable#InputMethod_stylusHandwritingSettingsActivity is not defined.

To launch stylus settings, use this method to get the android.content.Intent to launch the stylus handwriting settings activity.

e.g.

<code>startActivity(createStylusHandwritingSettingsActivityIntent());</code>

describeContents

Added in API level 3
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
fun dump(
    pw: Printer!,
    prefix: String!
): Unit

equals

Added in API level 3
fun equals(other: Any?): Boolean

Used to test whether the given parameter object is an InputMethodInfo and its Id is the same to this one.

Parameters
obj the reference object with which to compare.
o This value may be null.
Return
Boolean true if the given parameter object is an InputMethodInfo and its Id is the same to this one.

getComponent

Added in API level 3
fun getComponent(): ComponentName!

Return the component of the service that implements this input method.

getId

Added in API level 3
fun getId(): String!
Return
String! a unique ID for this input method, which is guaranteed to be the same as the result of getComponent().flattenToShortString().

getIsDefaultResourceId

Added in API level 3
fun getIsDefaultResourceId(): Int

Return the resource identifier of a resource inside of this input method's .apk that determines whether it should be considered a default input method for the system.

getPackageName

Added in API level 3
fun getPackageName(): String!

Return the .apk package that implements this input method.

getServiceInfo

Added in API level 3
fun getServiceInfo(): ServiceInfo!

Return the raw information about the Service implementing this input method. Do not modify the returned object.

getServiceName

Added in API level 3
fun getServiceName(): String!

Return the class name of the service component that implements this input method.

getSettingsActivity

Added in API level 3
fun getSettingsActivity(): String!

Return the class name of an activity that provides a settings UI for the input method. You can launch this activity be starting it with an android.content.Intent whose action is MAIN and with an explicit android.content.ComponentName composed of getPackageName and the class name returned here.

A null will be returned if there is no settings activity associated with the input method.

getSubtypeAt

Added in API level 11
fun getSubtypeAt(index: Int): InputMethodSubtype!

Return the Input Method's subtype at the specified index.

Parameters
index Int: the index of the subtype to return.

getSubtypeCount

Added in API level 11
fun getSubtypeCount(): Int

Return the count of the subtypes of Input Method.

hashCode

Added in API level 3
fun hashCode(): Int
Return
Int a hash code value for this object.

loadIcon

Added in API level 3
fun loadIcon(pm: PackageManager!): Drawable!

Load the user-displayed icon for this input method.

Parameters
pm PackageManager!: Supply a PackageManager used to load the input method's resources.

loadLabel

Added in API level 3
fun loadLabel(pm: PackageManager!): CharSequence!

Load the user-displayed label for this input method.

Parameters
pm PackageManager!: Supply a PackageManager used to load the input method's resources.

shouldShowInInputMethodPicker

Added in API level 31
fun shouldShowInInputMethodPicker(): Boolean

Returns true if this input method should be shown in menus for selecting an Input Method, such as the system Input Method Picker. This is false if the IME is intended to be accessed programmatically.

supportsConnectionlessStylusHandwriting

Added in API level 35
fun supportsConnectionlessStylusHandwriting(): Boolean

Returns whether the IME supports connectionless stylus handwriting sessions.

supportsStylusHandwriting

Added in API level 33
fun supportsStylusHandwriting(): Boolean

Returns if IME supports handwriting using stylus input.

suppressesSpellChecker

Added in API level 31
fun suppressesSpellChecker(): Boolean

Return true if this input method suppresses spell checker.

toString

Added in API level 3
fun toString(): String
Return
String a string representation of the object.

writeToParcel

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

Used to make this class parcelable.