Added in API level 34

TextBoundsInfoResult


class TextBoundsInfoResult
kotlin.Any
   ↳ android.view.inputmethod.TextBoundsInfoResult

The object that holds the result of the InputConnection#requestTextBoundsInfo(RectF, Executor, Consumer) call.

Summary

Constants
static Int

Result for InputConnection#requestTextBoundsInfo(RectF, Executor, Consumer) when the request is cancelled.

static Int

Result for InputConnection#requestTextBoundsInfo(RectF, Executor, Consumer) when the request failed.

static Int

Result for InputConnection#requestTextBoundsInfo(RectF, Executor, Consumer) when the editor successfully returns a TextBoundsInfo.

static Int

Result for InputConnection#requestTextBoundsInfo(RectF, Executor, Consumer) when the editor doesn't implement the method.

Public constructors

Create a TextBoundsInfoResult object with no TextBoundsInfo.

TextBoundsInfoResult(resultCode: Int, textBoundsInfo: TextBoundsInfo?)

Create a TextBoundsInfoResult object.

Public methods
Int

Return the result code of the InputConnection#requestTextBoundsInfo(RectF, Executor, Consumer) call.

TextBoundsInfo?

Return the TextBoundsInfo provided by the editor.

Constants

CODE_CANCELLED

Added in API level 34
static val CODE_CANCELLED: Int

Result for InputConnection#requestTextBoundsInfo(RectF, Executor, Consumer) when the request is cancelled. This happens when the InputConnection is or becomes invalidated while requesting the TextBoundsInfo, for example because a new InputConnection was started, or due to InputMethodManager#invalidateInput.

Value: 3

CODE_FAILED

Added in API level 34
static val CODE_FAILED: Int

Result for InputConnection#requestTextBoundsInfo(RectF, Executor, Consumer) when the request failed. This result code is returned when the editor can't provide a valid TextBoundsInfo. (e.g. The editor view is not laid out.)

Value: 2

CODE_SUCCESS

Added in API level 34
static val CODE_SUCCESS: Int

Result for InputConnection#requestTextBoundsInfo(RectF, Executor, Consumer) when the editor successfully returns a TextBoundsInfo.

Value: 1

CODE_UNSUPPORTED

Added in API level 34
static val CODE_UNSUPPORTED: Int

Result for InputConnection#requestTextBoundsInfo(RectF, Executor, Consumer) when the editor doesn't implement the method.

Value: 0

Public constructors

TextBoundsInfoResult

Added in API level 34
TextBoundsInfoResult(
    resultCode: Int,
    textBoundsInfo: TextBoundsInfo?)

Create a TextBoundsInfoResult object.

Parameters
resultCode Int: the result code of the InputConnection#requestTextBoundsInfo(RectF, Executor, Consumer) call. Value is android.view.inputmethod.TextBoundsInfoResult#CODE_UNSUPPORTED, android.view.inputmethod.TextBoundsInfoResult#CODE_SUCCESS, android.view.inputmethod.TextBoundsInfoResult#CODE_FAILED, or android.view.inputmethod.TextBoundsInfoResult#CODE_CANCELLED
textBoundsInfo TextBoundsInfo?: the returned TextBoundsInfo of the InputConnection#requestTextBoundsInfo(RectF, Executor, Consumer) call. It can't be null if the resultCode is CODE_SUCCESS.
Exceptions
java.lang.IllegalStateException if the resultCode is CODE_SUCCESS but the given textBoundsInfo is null.

Public methods

getTextBoundsInfo

Added in API level 34
fun getTextBoundsInfo(): TextBoundsInfo?

Return the TextBoundsInfo provided by the editor. It is non-null if the resultCode is CODE_SUCCESS. Otherwise, it can be null in the following conditions: