public final class

TextSelection.Builder

extends java.lang.Object

 java.lang.Object

↳androidx.textclassifier.TextSelection.Builder

Overview

Builder used to build TextSelection objects.

Summary

Constructors
publicBuilder(int startIndex, int endIndex)

Creates a builder used to build TextSelection objects.

Methods
public TextSelectionbuild()

Builds and returns TextSelection object.

public TextSelection.BuildersetEntityType(java.lang.String type, float confidenceScore)

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

public TextSelection.BuildersetExtras(Bundle extras)

Sets the extended, vendor specific data.

public TextSelection.BuildersetId(java.lang.String id)

Sets an id for the TextSelection object.

from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructors

public Builder(int startIndex, int endIndex)

Creates a builder used to build TextSelection objects.

Parameters:

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

Methods

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

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

Parameters:

confidenceScore: 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.

public TextSelection.Builder setId(java.lang.String id)

Sets an id for the TextSelection object.

public TextSelection.Builder setExtras(Bundle extras)

Sets the extended, vendor specific data.

public TextSelection build()

Builds and returns TextSelection object.