Save the date! Android Dev Summit is coming to Sunnyvale, CA on Oct 23-24, 2019.

Request

class Request
kotlin.Any
   ↳ androidx.textclassifier.TextSelection.Request

A request object for generating TextSelection.

Summary

Nested classes

A builder for building TextSelection requests.

Public methods
LocaleListCompat?

Int

Returns start index of the selected part of text.

Bundle

Returns the extended, vendor specific data.

Bundle

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

CharSequence

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

Int

Returns end index of the selected part of text.

static TextSelection.Request
createFromBundle(@NonNull bundle: Bundle)

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

Public methods

getDefaultLocales

@Nullable fun getDefaultLocales(): LocaleListCompat?
Return
LocaleListCompat?: ordered list of locale preferences that can be used to disambiguate the provided text.

getStartIndex

fun getStartIndex(): Int

Returns start index of the selected part of text.

getExtras

@NonNull 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.

toBundle

@NonNull fun toBundle(): Bundle

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

getText

@NonNull 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).

getEndIndex

fun getEndIndex(): Int

Returns end index of the selected part of text.

createFromBundle

@NonNull static fun createFromBundle(@NonNull bundle: Bundle): TextSelection.Request

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