# InputMethodService.InputMethodSessionImpl

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

# InputMethodSessionImpl

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/android/inputmethodservice/InputMethodService.InputMethodSessionImpl "View this page in Java")  

```
open class InputMethodSessionImpl : AbstractInputMethodService.AbstractInputMethodSessionImpl
```

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

Concrete implementation of[AbstractInputMethodService.AbstractInputMethodSessionImpl](https://developer.android.com/reference/kotlin/android/inputmethodservice/AbstractInputMethodService.AbstractInputMethodSessionImpl)that provides all of the standard behavior for an input method session.

## Summary

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

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Public methods                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        ||
|----------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| open[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [appPrivateCommand](https://developer.android.com/reference/kotlin/android/inputmethodservice/InputMethodService.InputMethodSessionImpl#appPrivateCommand(kotlin.String,%20android.os.Bundle))`(`action:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`, `data:` `[Bundle](https://developer.android.com/reference/kotlin/android/os/Bundle.html#)!`)` Call[InputMethodService.onAppPrivateCommand()](https://developer.android.com/reference/kotlin/android/inputmethodservice/InputMethodService#onAppPrivateCommand(kotlin.String,%20android.os.Bundle)).                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| open[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [displayCompletions](https://developer.android.com/reference/kotlin/android/inputmethodservice/InputMethodService.InputMethodSessionImpl#displayCompletions(kotlin.Array))`(`completions:` `[Array](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html)<[CompletionInfo](https://developer.android.com/reference/kotlin/android/view/inputmethod/CompletionInfo.html#)!>!`)` Call[InputMethodService.onDisplayCompletions()](https://developer.android.com/reference/kotlin/android/inputmethodservice/InputMethodService#onDisplayCompletions(kotlin.Array)).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| open[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [finishInput](https://developer.android.com/reference/kotlin/android/inputmethodservice/InputMethodService.InputMethodSessionImpl#finishInput())`()` <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| open[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [toggleSoftInput](https://developer.android.com/reference/kotlin/android/inputmethodservice/InputMethodService.InputMethodSessionImpl#toggleSoftInput(kotlin.Int,%20kotlin.Int))`(`showFlags:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `hideFlags:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Handles a request to toggle the IME visibility.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| open[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [updateCursor](https://developer.android.com/reference/kotlin/android/inputmethodservice/InputMethodService.InputMethodSessionImpl#updateCursor(android.graphics.Rect))`(`newCursor:` `[Rect](https://developer.android.com/reference/kotlin/android/graphics/Rect.html#)!`)` Call[InputMethodService.onUpdateCursor()](https://developer.android.com/reference/kotlin/android/inputmethodservice/InputMethodService#onUpdateCursor(android.graphics.Rect)).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| open[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [updateCursorAnchorInfo](https://developer.android.com/reference/kotlin/android/inputmethodservice/InputMethodService.InputMethodSessionImpl#updateCursorAnchorInfo(android.view.inputmethod.CursorAnchorInfo))`(`info:` `[CursorAnchorInfo](https://developer.android.com/reference/kotlin/android/view/inputmethod/CursorAnchorInfo.html#)!`)` Call[InputMethodService.onUpdateCursorAnchorInfo()](https://developer.android.com/reference/kotlin/android/inputmethodservice/InputMethodService#onUpdateCursorAnchorInfo(android.view.inputmethod.CursorAnchorInfo)).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| open[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [updateExtractedText](https://developer.android.com/reference/kotlin/android/inputmethodservice/InputMethodService.InputMethodSessionImpl#updateExtractedText(kotlin.Int,%20android.view.inputmethod.ExtractedText))`(`token:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `text:` `[ExtractedText](https://developer.android.com/reference/kotlin/android/view/inputmethod/ExtractedText.html#)!`)` Call[InputMethodService.onUpdateExtractedText()](https://developer.android.com/reference/kotlin/android/inputmethodservice/InputMethodService#onUpdateExtractedText(kotlin.Int,%20android.view.inputmethod.ExtractedText)).                                                                                                                                                                                                                                                                                                                                                                                                         |
| open[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [updateSelection](https://developer.android.com/reference/kotlin/android/inputmethodservice/InputMethodService.InputMethodSessionImpl#updateSelection(kotlin.Int,%20kotlin.Int,%20kotlin.Int,%20kotlin.Int,%20kotlin.Int,%20kotlin.Int))`(`oldSelStart:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `oldSelEnd:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `newSelStart:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `newSelEnd:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `candidatesStart:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `candidatesEnd:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Call[InputMethodService.onUpdateSelection()](https://developer.android.com/reference/kotlin/android/inputmethodservice/InputMethodService#onUpdateSelection(kotlin.Int,%20kotlin.Int,%20kotlin.Int,%20kotlin.Int,%20kotlin.Int,%20kotlin.Int)). |
| open[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [viewClicked](https://developer.android.com/reference/kotlin/android/inputmethodservice/InputMethodService.InputMethodSessionImpl#viewClicked(kotlin.Boolean))`(`focusChanged:` `[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)`)` <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |

| Inherited functions ||
|---|---|
| From class[InputMethodSession](https://developer.android.com/reference/kotlin/android/view/inputmethod/InputMethodSession.html#) |------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [appPrivateCommand](https://developer.android.com/reference/kotlin/android/view/inputmethod/InputMethodSession.html#appPrivateCommand(kotlin.String,%20android.os.Bundle))`(`action:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`, `data:` `[Bundle](https://developer.android.com/reference/kotlin/android/os/Bundle.html#)!`)` <br /> Process a private command sent from the application to the input method. This can be used to provide domain-specific features that are only known between certain input methods and their clients. <br />                                                                                                                                                                                                                                                                                                                              | | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [displayCompletions](https://developer.android.com/reference/kotlin/android/view/inputmethod/InputMethodSession.html#displayCompletions(kotlin.Array))`(`completions:` `[Array](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html)<[CompletionInfo](https://developer.android.com/reference/kotlin/android/view/inputmethod/CompletionInfo.html#)!>!`)` <br /> Called by a text editor that performs auto completion, to tell the input method about the completions it has available. This can be used by the input method to display them to the user to select the text to be inserted. <br />                                                                                                                                                                                                                                                                                                  | | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [finishInput](https://developer.android.com/reference/kotlin/android/view/inputmethod/InputMethodSession.html#finishInput())`()` <br /> This method is called when the application would like to stop receiving text input. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     | | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [toggleSoftInput](https://developer.android.com/reference/kotlin/android/view/inputmethod/InputMethodSession.html#toggleSoftInput(kotlin.Int,%20kotlin.Int))`(`showFlags:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `hideFlags:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` <br /> Toggle the soft input window. Applications can toggle the state of the soft input window. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                           | | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [updateCursor](https://developer.android.com/reference/kotlin/android/view/inputmethod/InputMethodSession.html#updateCursor(android.graphics.Rect))`(`newCursor:` `[Rect](https://developer.android.com/reference/kotlin/android/graphics/Rect.html#)!`)` <br /> This method is called when cursor location of the target input field has changed within its window. This is not normally called, but will only be reported if requested by the input method. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                   | | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [updateCursorAnchorInfo](https://developer.android.com/reference/kotlin/android/view/inputmethod/InputMethodSession.html#updateCursorAnchorInfo(android.view.inputmethod.CursorAnchorInfo))`(`cursorAnchorInfo:` `[CursorAnchorInfo](https://developer.android.com/reference/kotlin/android/view/inputmethod/CursorAnchorInfo.html#)!`)` <br /> This method is called when the cursor and/or the character position relevant to text input is changed on the screen. This is not called by default. It will only be reported if requested by the input method. <br />                                                                                                                                                                                                                                                                                                                                                  | | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [updateExtractedText](https://developer.android.com/reference/kotlin/android/view/inputmethod/InputMethodSession.html#updateExtractedText(kotlin.Int,%20android.view.inputmethod.ExtractedText))`(`token:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `text:` `[ExtractedText](https://developer.android.com/reference/kotlin/android/view/inputmethod/ExtractedText.html#)!`)` <br /> Called by a text editor to report its new extracted text when its contents change. This will only be called if the input method calls[InputConnection.getExtractedText()](https://developer.android.com/reference/kotlin/android/view/inputmethod/InputConnection.html#getExtractedText(android.view.inputmethod.ExtractedTextRequest,%20kotlin.Int))with the option to report updates. <br />                                                                                               | | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [updateSelection](https://developer.android.com/reference/kotlin/android/view/inputmethod/InputMethodSession.html#updateSelection(kotlin.Int,%20kotlin.Int,%20kotlin.Int,%20kotlin.Int,%20kotlin.Int,%20kotlin.Int))`(`oldSelStart:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `oldSelEnd:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `newSelStart:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `newSelEnd:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `candidatesStart:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `candidatesEnd:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` <br /> This method is called when the selection or cursor in the current target input field has changed. <br /> | | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [viewClicked](https://developer.android.com/reference/kotlin/android/view/inputmethod/InputMethodSession.html#viewClicked(kotlin.Boolean))`(`focusChanged:` `[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)`)` <br /> This method is called when the user tapped a text view. IMEs can't rely on this method being called because this was not part of the original IME protocol, so applications with custom text editing written before this method appeared will not call to inform the IME of this interaction. <br />                                                                                                                                                                                                                                                                                                                                                         | ||
| From class[AbstractInputMethodSessionImpl](https://developer.android.com/reference/kotlin/android/inputmethodservice/AbstractInputMethodService.AbstractInputMethodSessionImpl) |------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)       | [dispatchGenericMotionEvent](https://developer.android.com/reference/kotlin/android/inputmethodservice/AbstractInputMethodService.AbstractInputMethodSessionImpl#dispatchGenericMotionEvent(kotlin.Int,%20android.view.MotionEvent,%20android.view.inputmethod.InputMethodSession.EventCallback))`(`seq:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `event:` `[MotionEvent](https://developer.android.com/reference/kotlin/android/view/MotionEvent.html#)!`, `callback:` `[InputMethodSession.EventCallback](https://developer.android.com/reference/kotlin/android/view/inputmethod/InputMethodSession.EventCallback.html#)!`)` <br /> Take care of dispatching incoming generic motion events to the appropriate callbacks on the service, and tell the client when this is done. <br /> | | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)       | [dispatchKeyEvent](https://developer.android.com/reference/kotlin/android/inputmethodservice/AbstractInputMethodService.AbstractInputMethodSessionImpl#dispatchKeyEvent(kotlin.Int,%20android.view.KeyEvent,%20android.view.inputmethod.InputMethodSession.EventCallback))`(`seq:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `event:` `[KeyEvent](https://developer.android.com/reference/kotlin/android/view/KeyEvent.html#)!`, `callback:` `[InputMethodSession.EventCallback](https://developer.android.com/reference/kotlin/android/view/inputmethod/InputMethodSession.EventCallback.html#)!`)` <br /> Take care of dispatching incoming key events to the appropriate callbacks on the service, and tell the client when this is done. <br />                                         | | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)       | [dispatchTrackballEvent](https://developer.android.com/reference/kotlin/android/inputmethodservice/AbstractInputMethodService.AbstractInputMethodSessionImpl#dispatchTrackballEvent(kotlin.Int,%20android.view.MotionEvent,%20android.view.inputmethod.InputMethodSession.EventCallback))`(`seq:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `event:` `[MotionEvent](https://developer.android.com/reference/kotlin/android/view/MotionEvent.html#)!`, `callback:` `[InputMethodSession.EventCallback](https://developer.android.com/reference/kotlin/android/view/inputmethod/InputMethodSession.EventCallback.html#)!`)` <br /> Take care of dispatching incoming trackball events to the appropriate callbacks on the service, and tell the client when this is done. <br />              | | [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | [isEnabled](https://developer.android.com/reference/kotlin/android/inputmethodservice/AbstractInputMethodService.AbstractInputMethodSessionImpl#isEnabled())`()` <br /> Check whether this session has been enabled by the system. If not enabled, you should not execute any calls on to it. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            | | [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | [isRevoked](https://developer.android.com/reference/kotlin/android/inputmethodservice/AbstractInputMethodService.AbstractInputMethodSessionImpl#isRevoked())`()` <br /> Check whether this session has been revoked by the system. Revoked session is also always disabled, so there is generally no need to explicitly check for this. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  | | [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | [onShouldVerifyKeyEvent](https://developer.android.com/reference/kotlin/android/inputmethodservice/AbstractInputMethodService.AbstractInputMethodSessionImpl#onShouldVerifyKeyEvent(android.view.KeyEvent))`(`event:` `[KeyEvent](https://developer.android.com/reference/kotlin/android/view/KeyEvent.html#)`)` <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         | | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)       | [revokeSelf](https://developer.android.com/reference/kotlin/android/inputmethodservice/AbstractInputMethodService.AbstractInputMethodSessionImpl#revokeSelf())`()` <br /> Revoke the session from the client. This disabled the session, and prevents it from ever being enabled again. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  | | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)       | [setEnabled](https://developer.android.com/reference/kotlin/android/inputmethodservice/AbstractInputMethodService.AbstractInputMethodSessionImpl#setEnabled(kotlin.Boolean))`(`enabled:` `[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)`)` <br /> Change the enabled state of the session. This only works if the session has not been revoked. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                     | ||

## Public constructors

### InputMethodSessionImpl

```
InputMethodSessionImpl()
```

## Public methods

### appPrivateCommand

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

```
open fun appPrivateCommand(
    action: String!, 
    data: Bundle!
): Unit
```

Call[InputMethodService.onAppPrivateCommand()](https://developer.android.com/reference/kotlin/android/inputmethodservice/InputMethodService#onAppPrivateCommand(kotlin.String,%20android.os.Bundle)).

|                                                                                                                                 Parameters                                                                                                                                 ||
|----------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `action` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!:Name of the command to be performed. This*must*be a scoped name, i.e. prefixed with a package name you own, so that different developers will not create conflicting commands. |
| `data`   | [Bundle](https://developer.android.com/reference/kotlin/android/os/Bundle.html#)!:Any data to include with the command.                                                                                                                                          |

### displayCompletions

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

```
open fun displayCompletions(completions: Array<CompletionInfo!>!): Unit
```

Call[InputMethodService.onDisplayCompletions()](https://developer.android.com/reference/kotlin/android/inputmethodservice/InputMethodService#onDisplayCompletions(kotlin.Array)).

|                                                                                                                                                                        Parameters                                                                                                                                                                        ||
|---------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `completions` | [Array](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html)\<[CompletionInfo](https://developer.android.com/reference/kotlin/android/view/inputmethod/CompletionInfo.html#)!\>!:Array of text completions that are available, starting with the best. If this array is null, any existing completions will be removed. |

### finishInput

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

```
open fun finishInput(): Unit
```  

### toggleSoftInput

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

```
open fun toggleSoftInput(
    showFlags: Int, 
    hideFlags: Int
): Unit
```

**Deprecated:** *Starting in[Build.VERSION_CODES.S](https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#S:kotlin.Int)the system no longer invokes this method, instead it explicitly shows or hides the IME. An`InputMethodService`wishing to toggle its own visibility should instead invoke[android.inputmethodservice.InputMethodService#requestShowSelf](https://developer.android.com/reference/kotlin/android/inputmethodservice/InputMethodService#requestShowSelf(kotlin.Int))or[InputMethodService.requestHideSelf](https://developer.android.com/reference/kotlin/android/inputmethodservice/InputMethodService#requestHideSelf(kotlin.Int))*

Handles a request to toggle the IME visibility.

|                                                                                                                                                                                                                                                         Parameters                                                                                                                                                                                                                                                         ||
|-------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `showFlags` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):Value is either`0`or a combination of[android.view.inputmethod.InputMethodManager#SHOW_IMPLICIT](https://developer.android.com/reference/kotlin/android/view/inputmethod/InputMethodManager.html#SHOW_IMPLICIT:kotlin.Int), and[android.view.inputmethod.InputMethodManager#SHOW_FORCED](https://developer.android.com/reference/kotlin/android/view/inputmethod/InputMethodManager.html#SHOW_FORCED:kotlin.Int)                   |
| `hideFlags` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):Value is either`0`or a combination of[android.view.inputmethod.InputMethodManager#HIDE_IMPLICIT_ONLY](https://developer.android.com/reference/kotlin/android/view/inputmethod/InputMethodManager.html#HIDE_IMPLICIT_ONLY:kotlin.Int), and[android.view.inputmethod.InputMethodManager#HIDE_NOT_ALWAYS](https://developer.android.com/reference/kotlin/android/view/inputmethod/InputMethodManager.html#HIDE_NOT_ALWAYS:kotlin.Int) |

### updateCursor

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

```
open fun updateCursor(newCursor: Rect!): Unit
```

Call[InputMethodService.onUpdateCursor()](https://developer.android.com/reference/kotlin/android/inputmethodservice/InputMethodService#onUpdateCursor(android.graphics.Rect)).

|                                                                                         Parameters                                                                                          ||
|-------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `newCursor` | [Rect](https://developer.android.com/reference/kotlin/android/graphics/Rect.html#)!:The rectangle of the cursor currently being shown in the input field's window coordinates. |

### updateCursorAnchorInfo

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

```
open fun updateCursorAnchorInfo(info: CursorAnchorInfo!): Unit
```

Call[InputMethodService.onUpdateCursorAnchorInfo()](https://developer.android.com/reference/kotlin/android/inputmethodservice/InputMethodService#onUpdateCursorAnchorInfo(android.view.inputmethod.CursorAnchorInfo)).

|                                                       Parameters                                                        ||
|--------------------|-----------------------------------------------------------------------------------------------------|
| `cursorAnchorInfo` | Positional information relevant to text input, such as text insertion point and composition string. |

### updateExtractedText

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

```
open fun updateExtractedText(
    token: Int, 
    text: ExtractedText!
): Unit
```

Call[InputMethodService.onUpdateExtractedText()](https://developer.android.com/reference/kotlin/android/inputmethodservice/InputMethodService#onUpdateExtractedText(kotlin.Int,%20android.view.inputmethod.ExtractedText)).

|                                                                    Parameters                                                                    ||
|---------|-----------------------------------------------------------------------------------------------------------------------------------------|
| `token` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):The input method supplied token for identifying its request. |
| `text`  | [ExtractedText](https://developer.android.com/reference/kotlin/android/view/inputmethod/ExtractedText.html#)!:The new extracted text.   |

### updateSelection

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

```
open fun updateSelection(
    oldSelStart: Int, 
    oldSelEnd: Int, 
    newSelStart: Int, 
    newSelEnd: Int, 
    candidatesStart: Int, 
    candidatesEnd: Int
): Unit
```

Call[InputMethodService.onUpdateSelection()](https://developer.android.com/reference/kotlin/android/inputmethodservice/InputMethodService#onUpdateSelection(kotlin.Int,%20kotlin.Int,%20kotlin.Int,%20kotlin.Int,%20kotlin.Int,%20kotlin.Int)).

|                                                                           Parameters                                                                           ||
|-------------------|---------------------------------------------------------------------------------------------------------------------------------------------|
| `oldSelStart`     | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):The previous text offset of the cursor selection start position. |
| `oldSelEnd`       | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):The previous text offset of the cursor selection end position.   |
| `newSelStart`     | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):The new text offset of the cursor selection start position.      |
| `newSelEnd`       | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):The new text offset of the cursor selection end position.        |
| `candidatesStart` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):The text offset of the current candidate text start position.    |
| `candidatesEnd`   | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):The text offset of the current candidate text end position.      |

### viewClicked

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

```
open fun viewClicked(focusChanged: Boolean): Unit
```

|                                                                         Parameters                                                                          ||
|----------------|---------------------------------------------------------------------------------------------------------------------------------------------|
| `focusChanged` | [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html):true if the user changed the focused view by this click. |