TextSelection.Request

class TextSelection.Request


A request object for generating TextSelection.

Summary

Nested types

A builder for building TextSelection requests.

Public functions

java-static TextSelection.Request

Extracts a Request from a bundle that was added using toBundle.

LocaleListCompat?
@IntRange(from = 0) Int

Returns end index of the selected part of text.

Bundle

Returns the extended, vendor specific data.

@IntRange(from = 0) Int

Returns start index of the selected part of text.

CharSequence

Returns the text providing context for the selected text (which is specified by the sub sequence starting at startIndex and ending at endIndex).

Bundle

Adds this Request to a Bundle that can be read back with the same parameters to createFromBundle.

Public functions

createFromBundle

java-static fun createFromBundle(bundle: Bundle): TextSelection.Request

Extracts a Request from a bundle that was added using toBundle.

getDefaultLocales

fun getDefaultLocales(): LocaleListCompat?
Returns
LocaleListCompat?

ordered list of locale preferences that can be used to disambiguate the provided text.

getEndIndex

fun getEndIndex(): @IntRange(from = 0) Int

Returns end index of the selected part of text.

getExtras

fun getExtras(): Bundle

Returns the extended, vendor specific data.

NOTE: Each call to this method returns a new bundle copy so clients should prefer to hold a reference to the returned bundle rather than frequently calling this method. Avoid updating the content of this bundle. On pre-O devices, the values in the Bundle are not deep copied.

getStartIndex

fun getStartIndex(): @IntRange(from = 0) Int

Returns start index of the selected part of text.

getText

fun getText(): CharSequence

Returns the text providing context for the selected text (which is specified by the sub sequence starting at startIndex and ending at endIndex).

toBundle

fun toBundle(): Bundle

Adds this Request to a Bundle that can be read back with the same parameters to createFromBundle.