TextSelection
class TextSelection : Parcelable
| kotlin.Any | |
| ↳ | android.view.textclassifier.TextSelection |
Information about where text selection should be.
Summary
| Nested classes | |
|---|---|
|
Builder used to build |
|
|
A request object for generating TextSelection. |
|
| Inherited constants | |
|---|---|
| Public methods | |
|---|---|
| Int | |
| Float |
getConfidenceScore(entity: String!)Returns the confidence score for the specified entity. |
| String |
Returns the entity at the specified index. |
| Int |
Returns the number of entities found in the classified text. |
| Bundle |
Returns the extended data. |
| String? |
getId()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 |
toString() |
| Unit |
writeToParcel(dest: Parcel, flags: Int) |
| Properties | |
|---|---|
| static Parcelable.Creator<TextSelection!> | |
Public methods
describeContents
fun describeContents(): Int
| Return | |
|---|---|
Int |
a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either 0 or android.os.Parcelable#CONTENTS_FILE_DESCRIPTOR |
getConfidenceScore
fun getConfidenceScore(entity: String!): Float
Returns the confidence score for the specified entity. The value ranges from 0 (low confidence) to 1 (high confidence). 0 indicates that the entity was not found for the classified text.
| Return | |
|---|---|
Float |
Value is between 0.0f and 1.0f inclusive |
getEntity
fun getEntity(index: Int): String
Returns the entity at the specified index. Entities are ordered from high confidence to low confidence.
| Exceptions | |
|---|---|
java.lang.IndexOutOfBoundsException |
if the specified index is out of range. |
See Also
getEntityCount
fun getEntityCount(): Int
Returns the number of entities found in the classified text.
| Return | |
|---|---|
Int |
Value is 0 or greater |
getExtras
fun getExtras(): Bundle
Returns the extended data.
NOTE: Do not modify this bundle.
| Return | |
|---|---|
Bundle |
This value cannot be null. |
getId
fun getId(): String?
Returns the id, if one exists, for this object.
| Return | |
|---|---|
String? |
This value may be null. |
getSelectionEndIndex
fun getSelectionEndIndex(): Int
Returns the end index of the text selection.
getSelectionStartIndex
fun getSelectionStartIndex(): Int
Returns the start index of the text selection.
getTextClassification
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
fun toString(): String
| Return | |
|---|---|
String |
a string representation of the object. |
writeToParcel
fun writeToParcel(
dest: Parcel,
flags: Int
): Unit
| 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 android.os.Parcelable#PARCELABLE_WRITE_RETURN_VALUE, and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES |