setInitialSurroundingSubText

open fun setInitialSurroundingSubText(@NonNull editorInfo: EditorInfo, @NonNull subText: CharSequence, subTextStart: Int)(source)

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

the editor with which to set the text.

subText

The input text. When it was trimmed, subTextStart must be provided correctly.

subTextStart

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.