Added in [API level 3](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

# InputMethodImpl

*** ** * ** ***

```
open class InputMethodImpl : AbstractInputMethodService.AbstractInputMethodImpl
```

|---|---|---|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) |||
| ↳ | [android.inputmethodservice.AbstractInputMethodService.AbstractInputMethodImpl](https://developer.android.com/reference/kotlin/android/inputmethodservice/AbstractInputMethodService.AbstractInputMethodImpl) ||
|   | ↳ | [android.inputmethodservice.InputMethodService.InputMethodImpl](https://developer.android.com/reference/kotlin/android/inputmethodservice/InputMethodService.InputMethodImpl#) |

Concrete implementation of `https://developer.android.com/reference/kotlin/android/inputmethodservice/AbstractInputMethodService.AbstractInputMethodImpl` that provides all of the standard behavior for an input method.

## Summary

Inherited constants From class `https://developer.android.com/reference/kotlin/android/view/inputmethod/InputMethod.html#` `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html` `https://developer.android.com/reference/kotlin/android/view/inputmethod/InputMethod.html#SERVICE_INTERFACE:kotlin.String`


This is the interface name that a service implementing an input method should say that it supports -- that is, this is the action it uses for its intent filter. To be supported, the service must also require the `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#BIND_INPUT_METHOD:kotlin.String` permission so that other applications can not abuse it.

<br />

`https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html` `https://developer.android.com/reference/kotlin/android/view/inputmethod/InputMethod.html#SERVICE_META_DATA:kotlin.String`


Name under which an InputMethod service component publishes information about itself. This meta-data must reference an XML resource containing an ``<`https://developer.android.com/reference/kotlin/android/R.attr.html#inputMethod:kotlin.Int`>`` tag.

<br />

`https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` `https://developer.android.com/reference/kotlin/android/view/inputmethod/InputMethod.html#SHOW_EXPLICIT:kotlin.Int`


Flag for `https://developer.android.com/reference/kotlin/android/view/inputmethod/InputMethod.html#showSoftInput(kotlin.Int,%20android.os.ResultReceiver)`: this show has been explicitly requested by the user. If not set, the system has decided it may be a good idea to show the input method based on a navigation operation in the UI.

<br />

`https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` `https://developer.android.com/reference/kotlin/android/view/inputmethod/InputMethod.html#SHOW_FORCED:kotlin.Int`


Flag for `https://developer.android.com/reference/kotlin/android/view/inputmethod/InputMethod.html#showSoftInput(kotlin.Int,%20android.os.ResultReceiver)`: this show has been forced to happen by the user. If set, the input method should remain visible until deliberated dismissed by the user in its UI.

<br />

| Public constructors ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/inputmethodservice/InputMethodService.InputMethodImpl#InputMethodImpl()()` <br /> |

| Public methods ||
|---|---|
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/inputmethodservice/InputMethodService.InputMethodImpl#attachToken(android.os.IBinder)(token: https://developer.android.com/reference/kotlin/android/os/IBinder.html#!)` Called first thing after an input method is created, this supplies a unique token for the session it has with the system service. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/inputmethodservice/InputMethodService.InputMethodImpl#bindInput(android.view.inputmethod.InputBinding)(binding: https://developer.android.com/reference/kotlin/android/view/inputmethod/InputBinding.html#!)` Bind a new application environment in to the input method, so that it can later start and stop input processing. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/inputmethodservice/InputMethodService.InputMethodImpl#changeInputMethodSubtype(android.view.inputmethod.InputMethodSubtype)(subtype: https://developer.android.com/reference/kotlin/android/view/inputmethod/InputMethodSubtype.html#!)` Notify that the input method subtype is being changed in the same input method. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/inputmethodservice/InputMethodService.InputMethodImpl#hideSoftInput(kotlin.Int,%20android.os.ResultReceiver)(flags: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html, resultReceiver: https://developer.android.com/reference/kotlin/android/os/ResultReceiver.html#!)` Request that any soft input part of the input method be hidden from the user. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/inputmethodservice/InputMethodService.InputMethodImpl#restartInput(android.view.inputmethod.InputConnection,%20android.view.inputmethod.EditorInfo)(ic: https://developer.android.com/reference/kotlin/android/view/inputmethod/InputConnection.html#!, editorInfo: https://developer.android.com/reference/kotlin/android/view/inputmethod/EditorInfo.html#!)` This method is called when the state of this input method needs to be reset. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/inputmethodservice/InputMethodService.InputMethodImpl#showSoftInput(kotlin.Int,%20android.os.ResultReceiver)(flags: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html, resultReceiver: https://developer.android.com/reference/kotlin/android/os/ResultReceiver.html#!)` Request that any soft input part of the input method be shown to the user. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/inputmethodservice/InputMethodService.InputMethodImpl#startInput(android.view.inputmethod.InputConnection,%20android.view.inputmethod.EditorInfo)(ic: https://developer.android.com/reference/kotlin/android/view/inputmethod/InputConnection.html#!, editorInfo: https://developer.android.com/reference/kotlin/android/view/inputmethod/EditorInfo.html#!)` This method is called when the application starts to receive text and it is ready for this input method to process received events and send result text back to the application. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/inputmethodservice/InputMethodService.InputMethodImpl#unbindInput()()` Unbind an application environment, called when the information previously set by `https://developer.android.com/reference/kotlin/android/view/inputmethod/InputMethod.html#bindInput(android.view.inputmethod.InputBinding)` is no longer valid for this input method. |

Inherited functions From class `https://developer.android.com/reference/kotlin/android/view/inputmethod/InputMethod.html#` `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/android/view/inputmethod/InputMethod.html#attachToken(android.os.IBinder)(token: https://developer.android.com/reference/kotlin/android/os/IBinder.html#!)`


Called first thing after an input method is created, this supplies a unique token for the session it has with the system service. It is needed to identify itself with the service to validate its operations. This token **must not** be passed to applications, since it grants special priviledges that should not be given to applications.

The system guarantees that this method is called back between `https://developer.android.com/reference/kotlin/android/inputmethodservice/InputMethodService#onCreate()` and android.inputmethodservice.InputMethodService#onDestroy() at most once.   
This method must be called from the main thread of your app.

<br />

`https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/android/view/inputmethod/InputMethod.html#bindInput(android.view.inputmethod.InputBinding)(binding: https://developer.android.com/reference/kotlin/android/view/inputmethod/InputBinding.html#!)`


Bind a new application environment in to the input method, so that it can later start and stop input processing. Typically this method is called when this input method is enabled in an application for the first time.   
This method must be called from the main thread of your app.

<br />

`https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/android/view/inputmethod/InputMethod.html#changeInputMethodSubtype(android.view.inputmethod.InputMethodSubtype)(subtype: https://developer.android.com/reference/kotlin/android/view/inputmethod/InputMethodSubtype.html#!)`


Notify that the input method subtype is being changed in the same input method.   
This method must be called from the main thread of your app.

<br />

`https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/android/view/inputmethod/InputMethod.html#hideSoftInput(kotlin.Int,%20android.os.ResultReceiver)(flags: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html, resultReceiver: https://developer.android.com/reference/kotlin/android/os/ResultReceiver.html#!)`


Request that any soft input part of the input method be hidden from the user.   
This method must be called from the main thread of your app.

<br />

`https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/android/view/inputmethod/InputMethod.html#restartInput(android.view.inputmethod.InputConnection,%20android.view.inputmethod.EditorInfo)(inputConnection: https://developer.android.com/reference/kotlin/android/view/inputmethod/InputConnection.html#!, editorInfo: https://developer.android.com/reference/kotlin/android/view/inputmethod/EditorInfo.html#!)`


This method is called when the state of this input method needs to be reset.

Typically, this method is called when the input focus is moved from one text box to another.   
This method must be called from the main thread of your app.

<br />

`https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/android/view/inputmethod/InputMethod.html#showSoftInput(kotlin.Int,%20android.os.ResultReceiver)(flags: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html, resultReceiver: https://developer.android.com/reference/kotlin/android/os/ResultReceiver.html#!)`


Request that any soft input part of the input method be shown to the user.   
This method must be called from the main thread of your app.

<br />

`https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/android/view/inputmethod/InputMethod.html#startInput(android.view.inputmethod.InputConnection,%20android.view.inputmethod.EditorInfo)(inputConnection: https://developer.android.com/reference/kotlin/android/view/inputmethod/InputConnection.html#!, editorInfo: https://developer.android.com/reference/kotlin/android/view/inputmethod/EditorInfo.html#!)`


This method is called when the application starts to receive text and it is ready for this input method to process received events and send result text back to the application.   
This method must be called from the main thread of your app.

<br />

`https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/android/view/inputmethod/InputMethod.html#unbindInput()()`


Unbind an application environment, called when the information previously set by `https://developer.android.com/reference/kotlin/android/view/inputmethod/InputMethod.html#bindInput(android.view.inputmethod.InputBinding)` is no longer valid for this input method.

Typically this method is called when the application changes to be non-foreground.   
This method must be called from the main thread of your app.

<br />

From class `https://developer.android.com/reference/kotlin/android/inputmethodservice/AbstractInputMethodService.AbstractInputMethodImpl` `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/android/inputmethodservice/AbstractInputMethodService.AbstractInputMethodImpl#createSession(android.view.inputmethod.InputMethod.SessionCallback)(callback: https://developer.android.com/reference/kotlin/android/view/inputmethod/InputMethod.SessionCallback.html#!)`


Instantiate a new client session for the input method, by calling back to `https://developer.android.com/reference/kotlin/android/inputmethodservice/AbstractInputMethodService#onCreateInputMethodSessionInterface()`.   
This method must be called from the main thread of your app.

<br />

`https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/android/inputmethodservice/AbstractInputMethodService.AbstractInputMethodImpl#revokeSession(android.view.inputmethod.InputMethodSession)(session: https://developer.android.com/reference/kotlin/android/view/inputmethod/InputMethodSession.html#!)`


Take care of killing an existing session by calling its `https://developer.android.com/reference/kotlin/android/inputmethodservice/AbstractInputMethodService.AbstractInputMethodSessionImpl#revokeSelf()` method.   
This method must be called from the main thread of your app.

<br />

`https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/android/inputmethodservice/AbstractInputMethodService.AbstractInputMethodImpl#setSessionEnabled(android.view.inputmethod.InputMethodSession,%20kotlin.Boolean)(session: https://developer.android.com/reference/kotlin/android/view/inputmethod/InputMethodSession.html#!, enabled: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)`


Take care of enabling or disabling an existing session by calling its `https://developer.android.com/reference/kotlin/android/inputmethodservice/AbstractInputMethodService.AbstractInputMethodSessionImpl#revokeSelf()` method.   
This method must be called from the main thread of your app.

<br />

## Public constructors

### InputMethodImpl

```
InputMethodImpl()
```

## Public methods

### attachToken

Added in [API level 3](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun attachToken(token: IBinder!): Unit
```

Called first thing after an input method is created, this supplies a unique token for the session it has with the system service. It is needed to identify itself with the service to validate its operations. This token **must not** be passed to applications, since it grants special priviledges that should not be given to applications.

The system guarantees that this method is called back between `https://developer.android.com/reference/kotlin/android/inputmethodservice/InputMethodService#onCreate()` and android.inputmethodservice.InputMethodService#onDestroy() at most once.   
This method must be called from the main thread of your app.   
This method must be called from the main thread of your app.

### bindInput

Added in [API level 3](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun bindInput(binding: InputBinding!): Unit
```

Bind a new application environment in to the input method, so that it can later start and stop input processing. Typically this method is called when this input method is enabled in an application for the first time. This method must be called from the main thread of your app.

Calls `https://developer.android.com/reference/kotlin/android/inputmethodservice/InputMethodService#onBindInput()` when done.
.   
This method must be called from the main thread of your app.

| Parameters ||
|---|---|
| `binding` | [InputBinding](https://developer.android.com/reference/kotlin/android/view/inputmethod/InputBinding.html#)!: Information about the application window that is binding to the input method. |

### changeInputMethodSubtype

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun changeInputMethodSubtype(subtype: InputMethodSubtype!): Unit
```

Notify that the input method subtype is being changed in the same input method.   
This method must be called from the main thread of your app.   
This method must be called from the main thread of your app.

| Parameters ||
|---|---|
| `subtype` | [InputMethodSubtype](https://developer.android.com/reference/kotlin/android/view/inputmethod/InputMethodSubtype.html#)!: New subtype of the notified input method |

### hideSoftInput

Added in [API level 3](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun hideSoftInput(
    flags: Int, 
    resultReceiver: ResultReceiver!
): Unit
```

Request that any soft input part of the input method be hidden from the user.   
This method must be called from the main thread of your app.   
This method must be called from the main thread of your app.

| Parameters ||
|---|---|
| `flags` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): Provides additional information about the hide request. Currently always 0. |
| `resultReceiver` | [ResultReceiver](https://developer.android.com/reference/kotlin/android/os/ResultReceiver.html#)!: The client requesting the show may wish to be told the impact of their request, which should be supplied here. The result code should be `https://developer.android.com/reference/kotlin/android/view/inputmethod/InputMethodManager.html#RESULT_UNCHANGED_SHOWN:kotlin.Int`, `https://developer.android.com/reference/kotlin/android/view/inputmethod/InputMethodManager.html#RESULT_UNCHANGED_HIDDEN:kotlin.Int`, `https://developer.android.com/reference/kotlin/android/view/inputmethod/InputMethodManager.html#RESULT_SHOWN:kotlin.Int`, or `https://developer.android.com/reference/kotlin/android/view/inputmethod/InputMethodManager.html#RESULT_HIDDEN:kotlin.Int`. |

### restartInput

Added in [API level 3](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun restartInput(
    ic: InputConnection!, 
    editorInfo: EditorInfo!
): Unit
```

This method is called when the state of this input method needs to be reset.

Typically, this method is called when the input focus is moved from one text box to another.   
This method must be called from the main thread of your app.   
This method must be called from the main thread of your app.

| Parameters ||
|---|---|
| `inputConnection` | Optional specific input connection for communicating with the text box; if null, you should use the generic bound input connection. |
| `editorInfo` | [EditorInfo](https://developer.android.com/reference/kotlin/android/view/inputmethod/EditorInfo.html#)!: The attribute of the text box (typically, a EditText) that requests input. |

### showSoftInput

Added in [API level 3](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun showSoftInput(
    flags: Int, 
    resultReceiver: ResultReceiver!
): Unit
```

Request that any soft input part of the input method be shown to the user.   
This method must be called from the main thread of your app.   
This method must be called from the main thread of your app.

| Parameters ||
|---|---|
| `resultReceiver` | [ResultReceiver](https://developer.android.com/reference/kotlin/android/os/ResultReceiver.html#)!: The client requesting the show may wish to be told the impact of their request, which should be supplied here. The result code should be `https://developer.android.com/reference/kotlin/android/view/inputmethod/InputMethodManager.html#RESULT_UNCHANGED_SHOWN:kotlin.Int`, `https://developer.android.com/reference/kotlin/android/view/inputmethod/InputMethodManager.html#RESULT_UNCHANGED_HIDDEN:kotlin.Int`, `https://developer.android.com/reference/kotlin/android/view/inputmethod/InputMethodManager.html#RESULT_SHOWN:kotlin.Int`, or `https://developer.android.com/reference/kotlin/android/view/inputmethod/InputMethodManager.html#RESULT_HIDDEN:kotlin.Int`. |

### startInput

Added in [API level 3](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun startInput(
    ic: InputConnection!, 
    editorInfo: EditorInfo!
): Unit
```

This method is called when the application starts to receive text and it is ready for this input method to process received events and send result text back to the application.   
This method must be called from the main thread of your app.   
This method must be called from the main thread of your app.

| Parameters ||
|---|---|
| `inputConnection` | Optional specific input connection for communicating with the text box; if null, you should use the generic bound input connection. |
| `editorInfo` | [EditorInfo](https://developer.android.com/reference/kotlin/android/view/inputmethod/EditorInfo.html#)!: Information about the text box (typically, an EditText) that requests input. |

### unbindInput

Added in [API level 3](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun unbindInput(): Unit
```

Unbind an application environment, called when the information previously set by `https://developer.android.com/reference/kotlin/android/view/inputmethod/InputMethod.html#bindInput(android.view.inputmethod.InputBinding)` is no longer valid for this input method.

Typically this method is called when the application changes to be non-foreground.   
This method must be called from the main thread of your app.

Calls `https://developer.android.com/reference/kotlin/android/inputmethodservice/InputMethodService#onUnbindInput()` when done.
.   
This method must be called from the main thread of your app.