TextClassifierEvent.TextSelectionEvent.Builder


public static final class TextClassifierEvent.TextSelectionEvent.Builder
extends Builder<TextClassifierEvent.TextSelectionEvent.Builder>

java.lang.Object
   ↳ android.view.textclassifier.TextClassifierEvent.Builder<android.view.textclassifier.TextClassifierEvent.TextSelectionEvent.Builder>
     ↳ android.view.textclassifier.TextClassifierEvent.TextSelectionEvent.Builder


Builder class for TextSelectionEvent.

Summary

Public constructors

Builder(int eventType)

Creates a builder for building TextSelectionEvents.

Public methods

TextClassifierEvent.TextSelectionEvent build()

Builds and returns a TextSelectionEvent.

TextClassifierEvent.TextSelectionEvent.Builder setRelativeSuggestedWordEndIndex(int relativeSuggestedWordEndIndex)

Sets the relative word (exclusive) index of the end of the smart selection.

TextClassifierEvent.TextSelectionEvent.Builder setRelativeSuggestedWordStartIndex(int relativeSuggestedWordStartIndex)

Sets the relative word index of the start of the smart selection.

TextClassifierEvent.TextSelectionEvent.Builder setRelativeWordEndIndex(int relativeWordEndIndex)

Sets the relative word (exclusive) index of the end of the selection.

TextClassifierEvent.TextSelectionEvent.Builder setRelativeWordStartIndex(int relativeWordStartIndex)

Sets the relative word index of the start of the selection.

Inherited methods

T setActionIndices(int... actionIndices)

Sets the indices of the actions involved in this event.

T setEntityTypes(String... entityTypes)

Sets the entity types.

T setEventContext(TextClassificationContext eventContext)

Sets the event context.

T setEventIndex(int eventIndex)

Sets the index of this event in the series of events it belongs to.

T setExtras(Bundle extras)

Sets a bundle containing non-structured extra information about the event.

T setLocale(ULocale locale)

Sets the detected locale.

T setModelName(String modelVersion)

Sets the model name string.

T setResultId(String resultId)

Sets the id of the text classifier result related to this event.

T setScores(float... scores)

Sets the scores of the suggestions.

Object clone()

Creates and returns a copy of this object.

boolean equals(Object obj)

Indicates whether some other object is "equal to" this one.

void finalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

final Class<?> getClass()

Returns the runtime class of this Object.

int hashCode()

Returns a hash code value for the object.

final void notify()

Wakes up a single thread that is waiting on this object's monitor.

final void notifyAll()

Wakes up all threads that are waiting on this object's monitor.

String toString()

Returns a string representation of the object.

final void wait(long timeoutMillis, int nanos)

Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

final void wait(long timeoutMillis)

Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

final void wait()

Causes the current thread to wait until it is awakened, typically by being notified or interrupted.

Public constructors

Builder

Added in API level 29
public Builder (int eventType)

Creates a builder for building TextSelectionEvents.

Public methods

build

Added in API level 29
public TextClassifierEvent.TextSelectionEvent build ()

Builds and returns a TextSelectionEvent.

Returns
TextClassifierEvent.TextSelectionEvent This value cannot be null.

setRelativeSuggestedWordEndIndex

Added in API level 29
public TextClassifierEvent.TextSelectionEvent.Builder setRelativeSuggestedWordEndIndex (int relativeSuggestedWordEndIndex)

Sets the relative word (exclusive) index of the end of the smart selection.

Parameters
relativeSuggestedWordEndIndex int

Returns
TextClassifierEvent.TextSelectionEvent.Builder This value cannot be null.

setRelativeSuggestedWordStartIndex

Added in API level 29
public TextClassifierEvent.TextSelectionEvent.Builder setRelativeSuggestedWordStartIndex (int relativeSuggestedWordStartIndex)

Sets the relative word index of the start of the smart selection.

Parameters
relativeSuggestedWordStartIndex int

Returns
TextClassifierEvent.TextSelectionEvent.Builder This value cannot be null.

setRelativeWordEndIndex

Added in API level 29
public TextClassifierEvent.TextSelectionEvent.Builder setRelativeWordEndIndex (int relativeWordEndIndex)

Sets the relative word (exclusive) index of the end of the selection.

Parameters
relativeWordEndIndex int

Returns
TextClassifierEvent.TextSelectionEvent.Builder This value cannot be null.

setRelativeWordStartIndex

Added in API level 29
public TextClassifierEvent.TextSelectionEvent.Builder setRelativeWordStartIndex (int relativeWordStartIndex)

Sets the relative word index of the start of the selection.

Parameters
relativeWordStartIndex int

Returns
TextClassifierEvent.TextSelectionEvent.Builder This value cannot be null.

Develop your UI on Android.

Updated Feb 22, 2024

Develop your UI on Android.

Updated Oct 31, 2024

Discover the latest app development tools, platform updates, training, and documentation for developers across every Android device.

Updated Jan 3, 2024