IInputConnectionExtensions.CommitText Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
| Name | Description |
|---|---|
| CommitText(IInputConnection, String, Int32) |
Commit text to the text box and set the new cursor position. |
| CommitText(IInputConnection, String, Int32, TextAttribute) |
Commits text with additional text attributes. |
CommitText(IInputConnection, String, Int32)
Commit text to the text box and set the new cursor position.
public static bool CommitText(this Android.Views.InputMethods.IInputConnection self, string? text, int newCursorPosition);
static member CommitText : Android.Views.InputMethods.IInputConnection * string * int -> bool
Parameters
- self
- IInputConnection
The input connection on which to call the method.
- text
- String
The text to commit.
- 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
The value returned by the input connection's character sequence overload.
Remarks
Commit text to the text box and set the new cursor position.
This method replaces the currently composing text with text, then moves the cursor according to newCursorPosition. If there is no composing text, the new text is inserted at the cursor position, removing selected text if any. This behaves like calling SetComposingText(IInputConnection, String, Int32) and then FinishComposingText().
Calling this method causes the editor to call OnUpdateSelection(Int32, Int32, Int32, Int32, Int32, Int32) on the current input method after the batch edit is over. Editor authors must report the changes with UpdateSelection(View, Int32, Int32, Int32, Int32), waiting until any batch edit is over.
Android reference for android.view.inputmethod.InputConnection.commitText.
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(IInputConnection, String, Int32, TextAttribute)
Commits text with additional text attributes.
public static bool CommitText(this Android.Views.InputMethods.IInputConnection self, string text, int newCursorPosition, Android.Views.InputMethods.TextAttribute? textAttribute);
static member CommitText : Android.Views.InputMethods.IInputConnection * string * int * Android.Views.InputMethods.TextAttribute -> bool
Parameters
- self
- IInputConnection
The input connection on which to call the method.
- text
- String
The text to commit. This value cannot be null.
- 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. This value may be null.
Returns
The value returned by the input connection's character sequence overload.
Remarks
This variant of CommitText(IInputConnection, String, Int32) lets the input method provide extra information about the text.
Android reference for android.view.inputmethod.InputConnection.commitText.
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.