# Print output for @column tags ?> TextSelection.Builder - Android SDK | Android Developers

Most visited

Recently visited

TextSelection.Builder

public static final class TextSelection.Builder
extends Object

java.lang.Object
   ↳ android.view.textclassifier.TextSelection.Builder


Builder used to build TextSelection objects.

Summary

Public constructors

Builder(int startIndex, int endIndex)

Creates a builder used to build TextSelection objects.

Public methods

TextSelection build()

Builds and returns TextSelection object.

TextSelection.Builder setEntityType(String type, float confidenceScore)

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

TextSelection.Builder setExtras(Bundle extras)

Sets the extended data.

TextSelection.Builder setId(String id)

Sets an id for the TextSelection object.

Inherited methods

Public constructors

Builder

public Builder (int startIndex, 
                int endIndex)

Creates a builder used to build TextSelection objects.

Parameters
startIndex int: the start index of the text selection. Value is 0 or greater

endIndex int: the end index of the text selection. Must be greater than startIndex Value is 0 or greater

Public methods

build

public TextSelection build ()

Builds and returns TextSelection object.

Returns
TextSelection This value cannot be null.

setEntityType

public TextSelection.Builder setEntityType (String type, 
                float confidenceScore)

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

Parameters
type String: This value cannot be null. Value is TextClassifier.TYPE_UNKNOWN, TextClassifier.TYPE_OTHER, TextClassifier.TYPE_EMAIL, TextClassifier.TYPE_PHONE, TextClassifier.TYPE_ADDRESS, TextClassifier.TYPE_URL, TextClassifier.TYPE_DATE, TextClassifier.TYPE_DATE_TIME, TextClassifier.TYPE_FLIGHT_NUMBER, or android.view.textclassifier.TextClassifier.TYPE_DICTIONARY

confidenceScore float: 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. Value is between 0.0 and 1.0 inclusive

Returns
TextSelection.Builder This value cannot be null.

setExtras

public TextSelection.Builder setExtras (Bundle extras)

Sets the extended data.

Parameters
extras Bundle: This value may be null.

Returns
TextSelection.Builder this builder This value cannot be null.

setId

public TextSelection.Builder setId (String id)

Sets an id for the TextSelection object.

Parameters
id String: This value may be null.

Returns
TextSelection.Builder This value cannot be null.