Udostępnij za pośrednictwem


IInputConnection.CommitText Method

Definition

Overloads

CommitText(ICharSequence, Int32)

Commit text to the text box and set the new cursor position.

CommitText(ICharSequence, Int32, TextAttribute)

The variant of InputConnection#commitText(CharSequence, int).

CommitText(String, Int32, TextAttribute)

The variant of InputConnection#commitText(CharSequence, int).

CommitText(ICharSequence, Int32)

Commit text to the text box and set the new cursor position.

[Android.Runtime.Register("commitText", "(Ljava/lang/CharSequence;I)Z", "GetCommitText_Ljava_lang_CharSequence_IHandler:Android.Views.InputMethods.IInputConnectionInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")]
public bool CommitText (Java.Lang.ICharSequence? text, int newCursorPosition);
[<Android.Runtime.Register("commitText", "(Ljava/lang/CharSequence;I)Z", "GetCommitText_Ljava_lang_CharSequence_IHandler:Android.Views.InputMethods.IInputConnectionInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")>]
abstract member CommitText : Java.Lang.ICharSequence * int -> bool

Parameters

text
ICharSequence

The text to commit. This may include styles.

newCursorPosition
Int32

The new cursor position around the text, in Java characters. If > 0, this is relative to the end of the text - 1; if <= 0, this is relative to the start of the text. So a value of 1 will always advance the cursor to the position after the full text being inserted. Note that this means you can't position the cursor within the text, because the editor can make modifications to the text you are providing so it is not possible to correctly specify locations there.

Returns

true on success, false if the input connection is no longer valid.

Attributes

Remarks

Commit text to the text box and set the new cursor position.

This method removes the contents of the currently composing text and replaces it with the passed CharSequence, and then moves the cursor according to newCursorPosition. If there is no composing text when this method is called, the new text is inserted at the cursor position, removing text inside the selection if any. This behaves like calling #setComposingText(CharSequence, int) setComposingText(text, newCursorPosition) then #finishComposingText().

Calling this method will cause the editor to call android.inputmethodservice.InputMethodService#onUpdateSelection(int, int, int, int, int, int) on the current IME after the batch input is over. <strong>Editor authors</strong>, for this to happen you need to make the changes known to the input method by calling InputMethodManager#updateSelection(View, int, int, int, int), but be careful to wait until the batch edit is over if one is in progress.

Java documentation for android.view.inputmethod.InputConnection.commitText(java.lang.CharSequence, int).

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

CommitText(ICharSequence, Int32, TextAttribute)

The variant of InputConnection#commitText(CharSequence, int).

[Android.Runtime.Register("commitText", "(Ljava/lang/CharSequence;ILandroid/view/inputmethod/TextAttribute;)Z", "GetCommitText_Ljava_lang_CharSequence_ILandroid_view_inputmethod_TextAttribute_Handler:Android.Views.InputMethods.IInputConnection, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", ApiSince=33)]
public virtual bool CommitText (Java.Lang.ICharSequence text, int newCursorPosition, Android.Views.InputMethods.TextAttribute? textAttribute);
[<Android.Runtime.Register("commitText", "(Ljava/lang/CharSequence;ILandroid/view/inputmethod/TextAttribute;)Z", "GetCommitText_Ljava_lang_CharSequence_ILandroid_view_inputmethod_TextAttribute_Handler:Android.Views.InputMethods.IInputConnection, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", ApiSince=33)>]
abstract member CommitText : Java.Lang.ICharSequence * int * Android.Views.InputMethods.TextAttribute -> bool
override this.CommitText : Java.Lang.ICharSequence * int * Android.Views.InputMethods.TextAttribute -> bool

Parameters

text
ICharSequence

The text to commit. This may include styles.

newCursorPosition
Int32

The new cursor position around the text, in Java characters. If > 0, this is relative to the end of the text - 1; if <= 0, this is relative to the start of the text. So a value of 1 will always advance the cursor to the position after the full text being inserted. Note that this means you can't position the cursor within the text, because the editor can make modifications to the text you are providing so it is not possible to correctly specify locations there.

textAttribute
TextAttribute

The extra information about the text.

Returns

true on success, false if the input connection is no longer

Attributes

Remarks

The variant of InputConnection#commitText(CharSequence, int). This method is used to allow the IME to provide extra information while setting up text.

Java documentation for android.view.inputmethod.InputConnection.commitText(java.lang.CharSequence, int, android.view.inputmethod.TextAttribute).

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

CommitText(String, Int32, TextAttribute)

The variant of InputConnection#commitText(CharSequence, int).

public virtual bool CommitText (string text, int newCursorPosition, Android.Views.InputMethods.TextAttribute? textAttribute);
abstract member CommitText : string * int * Android.Views.InputMethods.TextAttribute -> bool
override this.CommitText : string * int * Android.Views.InputMethods.TextAttribute -> bool

Parameters

text
String

The text to commit. This may include styles.

newCursorPosition
Int32

The new cursor position around the text, in Java characters. If > 0, this is relative to the end of the text - 1; if <= 0, this is relative to the start of the text. So a value of 1 will always advance the cursor to the position after the full text being inserted. Note that this means you can't position the cursor within the text, because the editor can make modifications to the text you are providing so it is not possible to correctly specify locations there.

textAttribute
TextAttribute

The extra information about the text.

Returns

true on success, false if the input connection is no longer

Remarks

The variant of InputConnection#commitText(CharSequence, int). This method is used to allow the IME to provide extra information while setting up text.

Java documentation for android.view.inputmethod.InputConnection.commitText(java.lang.CharSequence, int, android.view.inputmethod.TextAttribute).

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