Added in API level 26

TextSelection


class TextSelection : Parcelable
kotlin.Any
   ↳ android.view.textclassifier.TextSelection

Information about where text selection should be.

Summary

Nested classes

Builder used to build TextSelection objects.

A request object for generating TextSelection.

Inherited constants
Public methods
Int

Describe the kinds of special objects contained in this Parcelable instance's marshaled representation.

Float

Returns the confidence score for the specified entity.

String
getEntity(index: Int)

Returns the entity at the specified index.

Int

Returns the number of entities found in the classified text.

Bundle

Returns the extended data.

String?

Returns the id, if one exists, for this object.

Int

Returns the end index of the text selection.

Int

Returns the start index of the text selection.

TextClassification?

Returns the text classification result of the suggested selection span.

String

Returns a string representation of the object.

Unit
writeToParcel(dest: Parcel, flags: Int)

Flatten this object in to a Parcel.

Properties
static Parcelable.Creator<TextSelection!>

Public methods

describeContents

Added in API level 28
fun describeContents(): Int

Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. For example, if the object will include a file descriptor in the output of writeToParcel(android.os.Parcel,int), the return value of this method must include the CONTENTS_FILE_DESCRIPTOR bit.

Return
Int a bitmask indicating the set of special object types marshaled by this Parcelable object instance.
Value is either 0 or

getEntityCount

Added in API level 26
fun getEntityCount(): Int

Returns the number of entities found in the classified text.

Return
Int Value is 0 or greater

getExtras

Added in API level 29
fun getExtras(): Bundle

Returns the extended data.

NOTE: Do not modify this bundle.

Return
Bundle This value cannot be null.

getId

Added in API level 28
fun getId(): String?

Returns the id, if one exists, for this object.

Return
String? This value may be null.

getSelectionEndIndex

Added in API level 26
fun getSelectionEndIndex(): Int

Returns the end index of the text selection.

getSelectionStartIndex

Added in API level 26
fun getSelectionStartIndex(): Int

Returns the start index of the text selection.

getTextClassification

Added in API level 31
fun getTextClassification(): TextClassification?

Returns the text classification result of the suggested selection span. Enables the text classification by calling TextSelection.Request.Builder.setIncludeTextClassification(boolean). If the text classifier does not support it, a null is returned.

toString

Added in API level 26
fun toString(): String

Returns a string representation of the object.

Return
String a string representation of the object.

writeToParcel

Added in API level 28
fun writeToParcel(
    dest: Parcel,
    flags: Int
): Unit

Flatten this object in to a Parcel.

Parameters
dest Parcel: The Parcel in which the object should be written.
This value cannot be null.
flags Int: Additional flags about how the object should be written. May be 0 or PARCELABLE_WRITE_RETURN_VALUE.
Value is either 0 or a combination of the following:

Properties

CREATOR

Added in API level 28
static val CREATOR: Parcelable.Creator<TextSelection!>