IInputConnection.SetComposingRegion Method

Definition

Overloads

SetComposingRegion(Int32, Int32)

Mark a certain region of text as composing text.

SetComposingRegion(Int32, Int32, TextAttribute)

The variant of InputConnection#setComposingRegion(int, int).

SetComposingRegion(Int32, Int32)

Mark a certain region of text as composing text.

[Android.Runtime.Register("setComposingRegion", "(II)Z", "GetSetComposingRegion_IIHandler:Android.Views.InputMethods.IInputConnectionInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")]
public bool SetComposingRegion (int start, int end);
[<Android.Runtime.Register("setComposingRegion", "(II)Z", "GetSetComposingRegion_IIHandler:Android.Views.InputMethods.IInputConnectionInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")>]
abstract member SetComposingRegion : int * int -> bool

Parameters

start
Int32

the position in the text at which the composing region begins

end
Int32

the position in the text at which the composing region ends

Returns

true on success, false if the input connection is no longer valid. Since Android android.os.Build.VERSION_CODES#N until android.os.Build.VERSION_CODES#TIRAMISU, this API returned false when the target application does not implement this method.

Attributes

Remarks

Mark a certain region of text as composing text. If there was a composing region, the characters are left as they were and the composing span removed, as if #finishComposingText() has been called. The default style for composing text is used.

The passed indices are clipped to the contents bounds. If the resulting region is zero-sized, no region is marked and the effect is the same as that of calling #finishComposingText(). 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.

Since this does not change the contents of the text, editors should not call InputMethodManager#updateSelection(View, int, int, int, int) and IMEs should not receive android.inputmethodservice.InputMethodService#onUpdateSelection(int, int, int, int, int, int).

This has no impact on the cursor/selection position. It may result in the cursor being anywhere inside or outside the composing region, including cases where the selection and the composing region overlap partially or entirely.

Java documentation for android.view.inputmethod.InputConnection.setComposingRegion(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.

Applies to

SetComposingRegion(Int32, Int32, TextAttribute)

The variant of InputConnection#setComposingRegion(int, int).

[Android.Runtime.Register("setComposingRegion", "(IILandroid/view/inputmethod/TextAttribute;)Z", "GetSetComposingRegion_IILandroid_view_inputmethod_TextAttribute_Handler:Android.Views.InputMethods.IInputConnection, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", ApiSince=33)]
public virtual bool SetComposingRegion (int start, int end, Android.Views.InputMethods.TextAttribute? textAttribute);
[<Android.Runtime.Register("setComposingRegion", "(IILandroid/view/inputmethod/TextAttribute;)Z", "GetSetComposingRegion_IILandroid_view_inputmethod_TextAttribute_Handler:Android.Views.InputMethods.IInputConnection, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", ApiSince=33)>]
abstract member SetComposingRegion : int * int * Android.Views.InputMethods.TextAttribute -> bool
override this.SetComposingRegion : int * int * Android.Views.InputMethods.TextAttribute -> bool

Parameters

start
Int32

the position in the text at which the composing region begins

end
Int32

the position in the text at which the composing region ends

textAttribute
TextAttribute

The extra information about the text.

Returns

true on success, false if the input connection is no longer valid. Since Android android.os.Build.VERSION_CODES#N until android.os.Build.VERSION_CODES#TIRAMISU, this API returned false when the target application does not implement this method.

Attributes

Remarks

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

Java documentation for android.view.inputmethod.InputConnection.setComposingRegion(int, 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