Skip to content

Most visited

Recently visited

navigation

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

TextSelection.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 setSignature(String signature)

Sets a signature for the TextSelection object.

Inherited methods

Public constructors

TextSelection.Builder

added in API level 26
TextSelection.Builder (int startIndex, 
                int endIndex)

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

added in API level 26
TextSelection build ()

Builds and returns TextSelection object.

Returns
TextSelection

setEntityType

added in API level 26
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 must never be null.

Value is TYPE_UNKNOWN, TYPE_OTHER, TYPE_EMAIL, TYPE_PHONE, TYPE_ADDRESS, TYPE_URL, TYPE_DATE, TYPE_DATE_TIME or TYPE_FLIGHT_NUMBER.

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

setSignature

TextSelection.Builder setSignature (String signature)

Sets a signature for the TextSelection object. The TextClassifier that generates the TextSelection object may use it as a way to internally identify the TextSelection object.

Parameters
signature String

This value must never be null.

Returns
TextSelection.Builder

This site uses cookies to store your preferences for site-specific language and display options.

Get the latest Android developer news and tips that will help you find success on Google Play.

* Required Fields

Hooray!

Follow Google Developers on WeChat

Browse this site in ?

You requested a page in , but your language preference for this site is .

Would you like to change your language preference and browse this site in ? If you want to change your language preference later, use the language menu at the bottom of each page.

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a short survey?
Help us improve the Android developer experience. (April 2018 — Developer Survey)