The Android Developer Challenge is back! Submit your idea before December 2.

Builder

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

Builder used to build TextSelection objects.

Summary

Public constructors

<init>(startIndex: Int, endIndex: Int)

Creates a builder used to build TextSelection objects.

Public methods

TextSelection

Builds and returns TextSelection object.

TextSelection.Builder
setEntityType(@NonNull type: String, confidenceScore: Float)

Sets an entity type for the classified text and assigns a confidence score.

TextSelection.Builder
setExtras(@Nullable extras: Bundle?)

Sets the extended, vendor specific data.

TextSelection.Builder
setId(@Nullable id: String?)

Sets an id for the TextSelection object.

Public constructors

<init>

Builder(startIndex: Int, endIndex: Int)

Creates a builder used to build TextSelection objects.

Parameters
startIndex Int: the start index of the text selection.
endIndex Int: the end index of the text selection. Must be greater than startIndex

Public methods

build

@NonNull fun build(): TextSelection

Builds and returns TextSelection object.

setEntityType

@NonNull fun setEntityType(@NonNull type: String, confidenceScore: Float): TextSelection.Builder

Sets an entity type for the classified text and assigns a confidence score.

Parameters
confidenceScore String: a value from 0 (low confidence) to 1 (high confidence). 0 implies the entity does not exist for the classified text. Values greater than 1 are clamped to 1.

setExtras

@NonNull fun setExtras(@Nullable extras: Bundle?): TextSelection.Builder

Sets the extended, vendor specific data.

setId

@NonNull fun setId(@Nullable id: String?): TextSelection.Builder

Sets an id for the TextSelection object.