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

# AbstractInputMethodImpl

*** ** * ** ***

```
abstract class AbstractInputMethodImpl : InputMethod
```

|---|---|
| [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#) |

Known Direct Subclasses [InputMethodService.InputMethodImpl](https://developer.android.com/reference/kotlin/android/inputmethodservice/InputMethodService.InputMethodImpl) [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.

Base class for derived classes to implement their `https://developer.android.com/reference/kotlin/android/view/inputmethod/InputMethod.html#` interface. This takes care of basic maintenance of the input method, but most behavior must be implemented in a derived class.

## 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/AbstractInputMethodService.AbstractInputMethodImpl#AbstractInputMethodImpl()()` <br /> |

| Public methods ||
|---|---|
| open [Unit](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()`. |
| open [Unit](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. |
| open [Unit](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. |

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

## Public constructors

### AbstractInputMethodImpl

```
AbstractInputMethodImpl()
```

## Public methods

### createSession

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

```
open fun createSession(callback: InputMethod.SessionCallback!): Unit
```

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.

| Parameters ||
|---|---|
| `callback` | [InputMethod.SessionCallback](https://developer.android.com/reference/kotlin/android/view/inputmethod/InputMethod.SessionCallback.html#)!: Interface that is called with the newly created session. |

### revokeSession

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

```
open fun revokeSession(session: InputMethodSession!): Unit
```

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.

| Parameters ||
|---|---|
| `session` | [InputMethodSession](https://developer.android.com/reference/kotlin/android/view/inputmethod/InputMethodSession.html#)!: The `https://developer.android.com/reference/kotlin/android/view/inputmethod/InputMethodSession.html#` previously provided through SessionCallback.sessionCreated() that is to be revoked. |

### setSessionEnabled

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

```
open fun setSessionEnabled(
    session: InputMethodSession!, 
    enabled: Boolean
): Unit
```

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.

| Parameters ||
|---|---|
| `session` | [InputMethodSession](https://developer.android.com/reference/kotlin/android/view/inputmethod/InputMethodSession.html#)!: The `https://developer.android.com/reference/kotlin/android/view/inputmethod/InputMethodSession.html#` previously provided through SessionCallback.sessionCreated() that is to be changed. |