IInputConnection.SetSelection(Int32, Int32) 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.
Set the selection of the text editor.
[Android.Runtime.Register("setSelection", "(II)Z", "GetSetSelection_IIHandler:Android.Views.InputMethods.IInputConnectionInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")]
public bool SetSelection (int start, int end);
[<Android.Runtime.Register("setSelection", "(II)Z", "GetSetSelection_IIHandler:Android.Views.InputMethods.IInputConnectionInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")>]
abstract member SetSelection : int * int -> bool
Parameters
- start
- Int32
the character index where the selection should start.
- end
- Int32
the character index where the selection should end.
Returns
true on success, false if the input connection is no longer valid.
- Attributes
Remarks
Set the selection of the text editor. To set the cursor position, start and end should have the same value.
Since this moves the cursor, 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.
This has no effect on the composing region which must stay unchanged. The order of start and end is not important. In effect, the region from start to end and the region from end to start is the same. Editor authors, be ready to accept a start that is greater than end.
Java documentation for android.view.inputmethod.InputConnection.setSelection(int, 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.