Share via


EditorInfo.SetInitialSurroundingText Method

Definition

Overloads

SetInitialSurroundingText(ICharSequence)

Editors may use this method to provide initial input text to IMEs.

SetInitialSurroundingText(String)

Editors may use this method to provide initial input text to IMEs.

SetInitialSurroundingText(ICharSequence)

Editors may use this method to provide initial input text to IMEs.

[Android.Runtime.Register("setInitialSurroundingText", "(Ljava/lang/CharSequence;)V", "GetSetInitialSurroundingText_Ljava_lang_CharSequence_Handler", ApiSince=30)]
public virtual void SetInitialSurroundingText (Java.Lang.ICharSequence sourceText);
[<Android.Runtime.Register("setInitialSurroundingText", "(Ljava/lang/CharSequence;)V", "GetSetInitialSurroundingText_Ljava_lang_CharSequence_Handler", ApiSince=30)>]
abstract member SetInitialSurroundingText : Java.Lang.ICharSequence -> unit
override this.SetInitialSurroundingText : Java.Lang.ICharSequence -> unit

Parameters

sourceText
ICharSequence

The complete input text.

Attributes

Remarks

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 View#onCreateInputConnection(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.

Starting from VERSION_CODES#S, spans that do not implement Parcelable will be automatically dropped.

<strong>Editor authors: </strong>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.

Java documentation for android.view.inputmethod.EditorInfo.setInitialSurroundingText(java.lang.CharSequence).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

SetInitialSurroundingText(String)

Editors may use this method to provide initial input text to IMEs.

public void SetInitialSurroundingText (string sourceText);
member this.SetInitialSurroundingText : string -> unit

Parameters

sourceText
String

The complete input text.

Remarks

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 View#onCreateInputConnection(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.

Starting from VERSION_CODES#S, spans that do not implement Parcelable will be automatically dropped.

<strong>Editor authors: </strong>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.

Java documentation for android.view.inputmethod.EditorInfo.setInitialSurroundingText(java.lang.CharSequence).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to