# EditorInfoCompat

# EditorInfoCompat

Artifact:[androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core)  
[View Source](https://cs.android.com/search?q=file:androidx/core/view/inputmethod/EditorInfoCompat.java+class:androidx.core.view.inputmethod.EditorInfoCompat)  
Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/core/view/inputmethod/EditorInfoCompat "View this page in Java")

<br />

```
class EditorInfoCompat
```

<br />

*** ** * ** ***

Helper for accessing features in[EditorInfo](https://developer.android.com/reference/android/view/inputmethod/EditorInfo.html)in a backwards compatible fashion.

## Summary

|                                    ### Constants                                    |
|-------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `const `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [IME_FLAG_FORCE_ASCII](https://developer.android.com/reference/kotlin/androidx/core/view/inputmethod/EditorInfoCompat#IME_FLAG_FORCE_ASCII())` = -2147483648` Flag of[imeOptions](https://developer.android.com/reference/android/view/inputmethod/EditorInfo.html#imeOptions()): used to request an IME that is capable of inputting ASCII characters.                                                                                                                                      |
| `const `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [IME_FLAG_NO_PERSONALIZED_LEARNING](https://developer.android.com/reference/kotlin/androidx/core/view/inputmethod/EditorInfoCompat#IME_FLAG_NO_PERSONALIZED_LEARNING())` = 16777216` Flag of[imeOptions](https://developer.android.com/reference/android/view/inputmethod/EditorInfo.html#imeOptions()): used to request that the IME does not update any personalized data such as typing history and personalized language model based on what the user typed on this text editing object. |

|                                                                                                                    ### Public constructors                                                                                                                     |
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ~~[EditorInfoCompat](https://developer.android.com/reference/kotlin/androidx/core/view/inputmethod/EditorInfoCompat#EditorInfoCompat())~~`()` **This function is deprecated.** This type should not be instantiated as it contains only static methods. <br /> |

|                                                                                 ### Public functions                                                                                  |
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `java-static `[Array](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html)`<`[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`!>` | [getContentMimeTypes](https://developer.android.com/reference/kotlin/androidx/core/view/inputmethod/EditorInfoCompat#getContentMimeTypes(android.view.inputmethod.EditorInfo))`(editorInfo: `[EditorInfo](https://developer.android.com/reference/android/view/inputmethod/EditorInfo.html)`)` Gets MIME types that can be accepted by the target editor if the IME calls[commitContent](https://developer.android.com/reference/kotlin/androidx/core/view/inputmethod/InputConnectionCompat#commitContent(android.view.inputmethod.InputConnection,android.view.inputmethod.EditorInfo,androidx.core.view.inputmethod.InputContentInfoCompat,int,android.os.Bundle))                                                                                                                                                                                                                           |
| `java-static `[CharSequence](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html)`?`                                                                       | [getInitialSelectedText](https://developer.android.com/reference/kotlin/androidx/core/view/inputmethod/EditorInfoCompat#getInitialSelectedText(android.view.inputmethod.EditorInfo,int))`(editorInfo: `[EditorInfo](https://developer.android.com/reference/android/view/inputmethod/EditorInfo.html)`, flags: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)` Gets the selected text, if any.                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| `java-static `[CharSequence](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html)`?`                                                                       | [getInitialTextAfterCursor](https://developer.android.com/reference/kotlin/androidx/core/view/inputmethod/EditorInfoCompat#getInitialTextAfterCursor(android.view.inputmethod.EditorInfo,int,int))`(editorInfo: `[EditorInfo](https://developer.android.com/reference/android/view/inputmethod/EditorInfo.html)`, length: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`, flags: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)` Get<var translate="no">n</var>characters of text after the current cursor position.                                                                                                                                                                                                                                                                                                             |
| `java-static `[CharSequence](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html)`?`                                                                       | [getInitialTextBeforeCursor](https://developer.android.com/reference/kotlin/androidx/core/view/inputmethod/EditorInfoCompat#getInitialTextBeforeCursor(android.view.inputmethod.EditorInfo,int,int))`(editorInfo: `[EditorInfo](https://developer.android.com/reference/android/view/inputmethod/EditorInfo.html)`, length: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`, flags: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)` Get<var translate="no">n</var>characters of text before the current cursor position.                                                                                                                                                                                                                                                                                                          |
| `java-static `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)                                                                                     | [isStylusHandwritingEnabled](https://developer.android.com/reference/kotlin/androidx/core/view/inputmethod/EditorInfoCompat#isStylusHandwritingEnabled(android.view.inputmethod.EditorInfo))`(editorInfo: `[EditorInfo](https://developer.android.com/reference/android/view/inputmethod/EditorInfo.html)`)` Returns`true`when an editor has stylus handwriting enabled.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| `java-static `[Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)                                                                                           | [setContentMimeTypes](https://developer.android.com/reference/kotlin/androidx/core/view/inputmethod/EditorInfoCompat#setContentMimeTypes(android.view.inputmethod.EditorInfo,java.lang.String[]))`(` ` editorInfo: `[EditorInfo](https://developer.android.com/reference/android/view/inputmethod/EditorInfo.html)`,` ` contentMimeTypes: `[Array](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html)`<`[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`!>?` `)` Sets MIME types that can be accepted by the target editor if the IME calls[commitContent](https://developer.android.com/reference/kotlin/androidx/core/view/inputmethod/InputConnectionCompat#commitContent(android.view.inputmethod.InputConnection,android.view.inputmethod.EditorInfo,androidx.core.view.inputmethod.InputContentInfoCompat,int,android.os.Bundle)). |
| `java-static `[Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)                                                                                           | [setInitialSurroundingSubText](https://developer.android.com/reference/kotlin/androidx/core/view/inputmethod/EditorInfoCompat#setInitialSurroundingSubText(android.view.inputmethod.EditorInfo,java.lang.CharSequence,int))`(` ` editorInfo: `[EditorInfo](https://developer.android.com/reference/android/view/inputmethod/EditorInfo.html)`,` ` subText: `[CharSequence](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html)`,` ` subTextStart: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) `)` Editors may use this method to provide initial input text to IMEs.                                                                                                                                                                                                                                                               |
| `java-static `[Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)                                                                                           | [setInitialSurroundingText](https://developer.android.com/reference/kotlin/androidx/core/view/inputmethod/EditorInfoCompat#setInitialSurroundingText(android.view.inputmethod.EditorInfo,java.lang.CharSequence))`(` ` editorInfo: `[EditorInfo](https://developer.android.com/reference/android/view/inputmethod/EditorInfo.html)`,` ` sourceText: `[CharSequence](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html) `)` Editors may use this method to provide initial input text to IMEs.                                                                                                                                                                                                                                                                                                                                                                      |
| `java-static `[Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)                                                                                           | [setStylusHandwritingEnabled](https://developer.android.com/reference/kotlin/androidx/core/view/inputmethod/EditorInfoCompat#setStylusHandwritingEnabled(android.view.inputmethod.EditorInfo,boolean))`(editorInfo: `[EditorInfo](https://developer.android.com/reference/android/view/inputmethod/EditorInfo.html)`, enabled: `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)`)` Set`true`if the editor has[stylus handwriting](https://developer.android.com/reference/android/view/inputmethod/InputMethodManager.html#startStylusHandwriting(android.view.View))enabled.                                                                                                                                                                                                                                                                               |

## Constants

### IME_FLAG_FORCE_ASCII

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)  

```
const val IME_FLAG_FORCE_ASCII = -2147483648: Int
```

Flag of[imeOptions](https://developer.android.com/reference/android/view/inputmethod/EditorInfo.html#imeOptions()): used to request an IME that is capable of inputting ASCII characters.

The intention of this flag is to ensure that the user can type Roman alphabet characters in a[android.widget.TextView](https://developer.android.com/reference/android/widget/TextView.html). It is typically used for an account ID or password input.

In many cases, IMEs are already able to input ASCII even without being told so (such IMEs already respect this flag in a sense), but there are cases when this is not the default. For instance, users of languages using a different script like Arabic, Greek, Hebrew or Russian typically have a keyboard that can't input ASCII characters by default.

Applications need to be aware that the flag is not a guarantee, and some IMEs may not respect it. However, it is strongly recommended for IME authors to respect this flag especially when their IME could end up with a state where only languages using non-ASCII are enabled.  

### IME_FLAG_NO_PERSONALIZED_LEARNING

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)  

```
const val IME_FLAG_NO_PERSONALIZED_LEARNING = 16777216: Int
```

Flag of[imeOptions](https://developer.android.com/reference/android/view/inputmethod/EditorInfo.html#imeOptions()): used to request that the IME does not update any personalized data such as typing history and personalized language model based on what the user typed on this text editing object. Typical use cases are:

- When the application is in a special mode, where user's activities are expected to be not recorded in the application's history. Some web browsers and chat applications may have this kind of modes.
- When storing typing history does not make much sense. Specifying this flag in typing games may help to avoid typing history from being filled up with words that the user is less likely to type in their daily life. Another example is that when the application already knows that the expected input is not a valid word (e.g. a promotion code that is not a valid word in any natural language).

Applications need to be aware that the flag is not a guarantee, and some IMEs may not respect it.  

## Public constructors

### EditorInfoCompat

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)  
Deprecated in[1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)  

```
[EditorInfoCompat](https://developer.android.com/reference/kotlin/androidx/core/view/inputmethod/EditorInfoCompat#EditorInfoCompat())()
```
| **This function is deprecated.**   
|
This type should not be instantiated as it contains only static methods.  

## Public functions

### getContentMimeTypes

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)  

```
java-static fun getContentMimeTypes(editorInfo: EditorInfo): Array<String!>
```

Gets MIME types that can be accepted by the target editor if the IME calls[commitContent](https://developer.android.com/reference/kotlin/androidx/core/view/inputmethod/InputConnectionCompat#commitContent(android.view.inputmethod.InputConnection,android.view.inputmethod.EditorInfo,androidx.core.view.inputmethod.InputContentInfoCompat,int,android.os.Bundle))  

|                                                  Parameters                                                  |
|--------------------------------------------------------------------------------------------------------------|---------------------------------------------|
| `editorInfo: `[EditorInfo](https://developer.android.com/reference/android/view/inputmethod/EditorInfo.html) | the editor from which we get the MIME types |

|                                                                                 Returns                                                                                 |
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Array](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html)`<`[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`!>` | an array of MIME types. An empty array means that[commitContent](https://developer.android.com/reference/kotlin/androidx/core/view/inputmethod/InputConnectionCompat#commitContent(android.view.inputmethod.InputConnection,android.view.inputmethod.EditorInfo,androidx.core.view.inputmethod.InputContentInfoCompat,int,android.os.Bundle))is not supported on this editor |

### getInitialSelectedText

Added in[1.5.0](https://developer.android.com/jetpack/androidx/releases/core#1.5.0)  

```
java-static fun getInitialSelectedText(editorInfo: EditorInfo, flags: Int): CharSequence?
```

Gets the selected text, if any. May be`null`when no text is selected or the selected text is way too long.  

|                                                  Parameters                                                  |
|--------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `editorInfo: `[EditorInfo](https://developer.android.com/reference/android/view/inputmethod/EditorInfo.html) | the editor with which to get the text.                                                                                                                                                                                    |
| `flags: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)                         | Supplies additional options controlling how the text is returned. May be either 0 or[GET_TEXT_WITH_STYLES](https://developer.android.com/reference/android/view/inputmethod/InputConnection.html#GET_TEXT_WITH_STYLES()). |

|                                              Returns                                              |
|---------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [CharSequence](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html)`?` | the text that is currently selected, if any. It could be an empty string when there is no text selected. When`null`is returned, the selected text might be too long or this protocol is not supported. |

### getInitialTextAfterCursor

Added in[1.5.0](https://developer.android.com/jetpack/androidx/releases/core#1.5.0)  

```
java-static fun getInitialTextAfterCursor(editorInfo: EditorInfo, length: Int, flags: Int): CharSequence?
```

Get<var translate="no">n</var>characters of text after the current cursor position. May be`null`when the protocol is not supported.  

|                                                  Parameters                                                  |
|--------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `editorInfo: `[EditorInfo](https://developer.android.com/reference/android/view/inputmethod/EditorInfo.html) | the editor with which to get the text.                                                                                                                                                                                    |
| `length: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)                        | The expected length of the text.                                                                                                                                                                                          |
| `flags: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)                         | Supplies additional options controlling how the text is returned. May be either 0 or[GET_TEXT_WITH_STYLES](https://developer.android.com/reference/android/view/inputmethod/InputConnection.html#GET_TEXT_WITH_STYLES()). |

|                                              Returns                                              |
|---------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [CharSequence](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html)`?` | the text after the cursor position; the length of the returned text might be less than<var translate="no">n</var>. When there is no text after the cursor, an empty string will be returned. It could also be`null`when the editor or system could not support this protocol. |

### getInitialTextBeforeCursor

Added in[1.5.0](https://developer.android.com/jetpack/androidx/releases/core#1.5.0)  

```
java-static fun getInitialTextBeforeCursor(editorInfo: EditorInfo, length: Int, flags: Int): CharSequence?
```

Get<var translate="no">n</var>characters of text before the current cursor position. May be`null`when the protocol is not supported.  

|                                                  Parameters                                                  |
|--------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `editorInfo: `[EditorInfo](https://developer.android.com/reference/android/view/inputmethod/EditorInfo.html) | the editor with which to get the text.                                                                                                                                                                                    |
| `length: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)                        | The expected length of the text.                                                                                                                                                                                          |
| `flags: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)                         | Supplies additional options controlling how the text is returned. May be either 0 or[GET_TEXT_WITH_STYLES](https://developer.android.com/reference/android/view/inputmethod/InputConnection.html#GET_TEXT_WITH_STYLES()). |

|                                              Returns                                              |
|---------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [CharSequence](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html)`?` | the text before the cursor position; the length of the returned text might be less than<var translate="no">n</var>. When there is no text before the cursor, an empty string will be returned. It could also be`null`when the editor or system could not support this protocol. |

### isStylusHandwritingEnabled

Added in[1.13.0](https://developer.android.com/jetpack/androidx/releases/core#1.13.0)  

```
java-static fun isStylusHandwritingEnabled(editorInfo: EditorInfo): Boolean
```

Returns`true`when an editor has stylus handwriting enabled.`false`by default.  

|                                                  Parameters                                                  |
|--------------------------------------------------------------------------------------------------------------|----------------------------------------------------------|
| `editorInfo: `[EditorInfo](https://developer.android.com/reference/android/view/inputmethod/EditorInfo.html) | the editor from which we get stylus handwriting enabled. |

|                                                                                                See also                                                                                                |
|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [setStylusHandwritingEnabled](https://developer.android.com/reference/kotlin/androidx/core/view/inputmethod/EditorInfoCompat#setStylusHandwritingEnabled(android.view.inputmethod.EditorInfo,boolean)) |   |
| [isStylusHandwritingAvailable](https://developer.android.com/reference/android/view/inputmethod/InputMethodManager.html#isStylusHandwritingAvailable())                                                |   |

### setContentMimeTypes

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)  

```
java-static fun setContentMimeTypes(
    editorInfo: EditorInfo,
    contentMimeTypes: Array<String!>?
): Unit
```

Sets MIME types that can be accepted by the target editor if the IME calls[commitContent](https://developer.android.com/reference/kotlin/androidx/core/view/inputmethod/InputConnectionCompat#commitContent(android.view.inputmethod.InputConnection,android.view.inputmethod.EditorInfo,androidx.core.view.inputmethod.InputContentInfoCompat,int,android.os.Bundle)).  

|                                                                                          Parameters                                                                                          |
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `editorInfo: `[EditorInfo](https://developer.android.com/reference/android/view/inputmethod/EditorInfo.html)                                                                                 | the editor with which we associate supported MIME types                                                                                                                                                                                                                                                                                                                               |
| `contentMimeTypes: `[Array](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html)`<`[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`!>?` | an array of MIME types.`null`and an empty array means that[commitContent](https://developer.android.com/reference/kotlin/androidx/core/view/inputmethod/InputConnectionCompat#commitContent(android.view.inputmethod.InputConnection,android.view.inputmethod.EditorInfo,androidx.core.view.inputmethod.InputContentInfoCompat,int,android.os.Bundle))is not supported on this Editor |

### setInitialSurroundingSubText

Added in[1.5.0](https://developer.android.com/jetpack/androidx/releases/core#1.5.0)  

```
java-static fun setInitialSurroundingSubText(
    editorInfo: EditorInfo,
    subText: CharSequence,
    subTextStart: Int
): Unit
```

Editors may use this method to provide initial input text to IMEs. As the surrounding text could be used to provide various input assistance, we recommend editors to provide the complete initial input text in its[onCreateInputConnection](https://developer.android.com/reference/android/view/View.html#onCreateInputConnection(android.view.inputmethod.EditorInfo))callback. When trimming the input text is needed, call this method instead of`setInitialSurroundingText(CharSequence)`and provide the trimmed position info. Always try to include the selected text within`subText`to give the system best flexibility to choose where and how to trim`subText`when necessary.  

|                                                  Parameters                                                  |
|--------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------|
| `editorInfo: `[EditorInfo](https://developer.android.com/reference/android/view/inputmethod/EditorInfo.html) | the editor with which to set the text.                                                                                                      |
| `subText: `[CharSequence](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html)    | The input text. When it was trimmed,`subTextStart`must be provided correctly.                                                               |
| `subTextStart: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)                  | The position that the input text got trimmed. For example, when the editor wants to trim out the first 10 chars, subTextStart should be 10. |

### setInitialSurroundingText

Added in[1.5.0](https://developer.android.com/jetpack/androidx/releases/core#1.5.0)  

```
java-static fun setInitialSurroundingText(
    editorInfo: EditorInfo,
    sourceText: CharSequence
): Unit
```

Editors may use this method to provide initial input text to IMEs. As the surrounding text could be used to provide various input assistance, we recommend editors to provide the complete initial input text in its[onCreateInputConnection](https://developer.android.com/reference/android/view/View.html#onCreateInputConnection(android.view.inputmethod.EditorInfo))callback. The supplied text will then be processed to serve`#getInitialTextBeforeCursor`,`#getInitialSelectedText`, and`#getInitialTextBeforeCursor`. System is allowed to trim`sourceText`for various reasons while keeping the most valuable data to IMEs.

**Editor authors:**Providing the initial input text helps reducing IPC calls for IMEs to provide many modern features right after the connection setup. We recommend calling this method in your implementation.  

|                                                  Parameters                                                  |
|--------------------------------------------------------------------------------------------------------------|----------------------------------------|
| `editorInfo: `[EditorInfo](https://developer.android.com/reference/android/view/inputmethod/EditorInfo.html) | the editor with which to set the text. |
| `sourceText: `[CharSequence](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html) | The complete input text.               |

### setStylusHandwritingEnabled

Added in[1.13.0](https://developer.android.com/jetpack/androidx/releases/core#1.13.0)  

```
java-static fun setStylusHandwritingEnabled(editorInfo: EditorInfo, enabled: Boolean): Unit
```

Set`true`if the editor has[stylus handwriting](https://developer.android.com/reference/android/view/inputmethod/InputMethodManager.html#startStylusHandwriting(android.view.View))enabled.`false`by default, editor must set it`true`to indicate that it supports stylus handwriting.  

|                                                  Parameters                                                  |
|--------------------------------------------------------------------------------------------------------------|---------------------------------------------------|
| `editorInfo: `[EditorInfo](https://developer.android.com/reference/android/view/inputmethod/EditorInfo.html) | the editor with which we set handwriting enabled. |
| `enabled: `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)               | `true`if stylus handwriting is enabled.           |

|                                                            See also                                                            |
|--------------------------------------------------------------------------------------------------------------------------------|---|
| [setAutoHandwritingEnabled](https://developer.android.com/reference/android/view/View.html#setAutoHandwritingEnabled(boolean)) |   |