# TextClassifierEvent.TextSelectionEvent.Builder

Added in[API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Summary:[Ctors](https://developer.android.com/reference/android/view/textclassifier/TextClassifierEvent.TextSelectionEvent.Builder#pubctors)\|[Methods](https://developer.android.com/reference/android/view/textclassifier/TextClassifierEvent.TextSelectionEvent.Builder#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/android/view/textclassifier/TextClassifierEvent.TextSelectionEvent.Builder#inhmethods)  

# TextClassifierEvent.TextSelectionEvent.Builder

*** ** * ** ***

[Kotlin](https://developer.android.com/reference/kotlin/android/view/textclassifier/TextClassifierEvent.TextSelectionEvent.Builder "View this page in Kotlin")\|Java

`
public
static
final

class
TextClassifierEvent.TextSelectionEvent.Builder
`  
`


``

extends `[Builder](https://developer.android.com/reference/android/view/textclassifier/TextClassifierEvent.Builder)`<`[TextClassifierEvent.TextSelectionEvent.Builder](https://developer.android.com/reference/android/view/textclassifier/TextClassifierEvent.TextSelectionEvent.Builder)`>


``


`

|---|---|----------------------------------------------------------------------------|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object)     |||
| ↳ | [android.view.textclassifier.TextClassifierEvent.Builder](https://developer.android.com/reference/android/view/textclassifier/TextClassifierEvent.Builder)\<[android.view.textclassifier.TextClassifierEvent.TextSelectionEvent.Builder](https://developer.android.com/reference/android/view/textclassifier/TextClassifierEvent.TextSelectionEvent.Builder)\> ||
|   | ↳ | android.view.textclassifier.TextClassifierEvent.TextSelectionEvent.Builder |

<br />

*** ** * ** ***

Builder class for[TextSelectionEvent](https://developer.android.com/reference/android/view/textclassifier/TextClassifierEvent.TextSelectionEvent).

## Summary

|                                                                                                                                                       ### Public constructors                                                                                                                                                       ||
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| ` `[Builder](https://developer.android.com/reference/android/view/textclassifier/TextClassifierEvent.TextSelectionEvent.Builder#Builder(int))`(int eventType) ` Creates a builder for building[TextSelectionEvent](https://developer.android.com/reference/android/view/textclassifier/TextClassifierEvent.TextSelectionEvent)s. |

|                                                                                                                                                                                                                                     ### Public methods                                                                                                                                                                                                                                     ||
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` `[TextClassifierEvent.TextSelectionEvent](https://developer.android.com/reference/android/view/textclassifier/TextClassifierEvent.TextSelectionEvent)                 | ` `[build](https://developer.android.com/reference/android/view/textclassifier/TextClassifierEvent.TextSelectionEvent.Builder#build())`() ` Builds and returns a[TextSelectionEvent](https://developer.android.com/reference/android/view/textclassifier/TextClassifierEvent.TextSelectionEvent).                 |
| ` `[TextClassifierEvent.TextSelectionEvent.Builder](https://developer.android.com/reference/android/view/textclassifier/TextClassifierEvent.TextSelectionEvent.Builder) | ` `[setRelativeSuggestedWordEndIndex](https://developer.android.com/reference/android/view/textclassifier/TextClassifierEvent.TextSelectionEvent.Builder#setRelativeSuggestedWordEndIndex(int))`(int relativeSuggestedWordEndIndex) ` Sets the relative word (exclusive) index of the end of the smart selection. |
| ` `[TextClassifierEvent.TextSelectionEvent.Builder](https://developer.android.com/reference/android/view/textclassifier/TextClassifierEvent.TextSelectionEvent.Builder) | ` `[setRelativeSuggestedWordStartIndex](https://developer.android.com/reference/android/view/textclassifier/TextClassifierEvent.TextSelectionEvent.Builder#setRelativeSuggestedWordStartIndex(int))`(int relativeSuggestedWordStartIndex) ` Sets the relative word index of the start of the smart selection.     |
| ` `[TextClassifierEvent.TextSelectionEvent.Builder](https://developer.android.com/reference/android/view/textclassifier/TextClassifierEvent.TextSelectionEvent.Builder) | ` `[setRelativeWordEndIndex](https://developer.android.com/reference/android/view/textclassifier/TextClassifierEvent.TextSelectionEvent.Builder#setRelativeWordEndIndex(int))`(int relativeWordEndIndex) ` Sets the relative word (exclusive) index of the end of the selection.                                  |
| ` `[TextClassifierEvent.TextSelectionEvent.Builder](https://developer.android.com/reference/android/view/textclassifier/TextClassifierEvent.TextSelectionEvent.Builder) | ` `[setRelativeWordStartIndex](https://developer.android.com/reference/android/view/textclassifier/TextClassifierEvent.TextSelectionEvent.Builder#setRelativeWordStartIndex(int))`(int relativeWordStartIndex) ` Sets the relative word index of the start of the selection.                                      |

| ### Inherited methods |
|-----------------------|---|
| From class` `[android.view.textclassifier.TextClassifierEvent.Builder](https://developer.android.com/reference/android/view/textclassifier/TextClassifierEvent.Builder)` ` |------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` T` | ` `[setActionIndices](https://developer.android.com/reference/android/view/textclassifier/TextClassifierEvent.Builder#setActionIndices(int[]))`(int... actionIndices) ` Sets the indices of the actions involved in this event.                                                                                                                                    | | ` T` | ` `[setEntityTypes](https://developer.android.com/reference/android/view/textclassifier/TextClassifierEvent.Builder#setEntityTypes(java.lang.String[]))`(`[String...](https://developer.android.com/reference/java/lang/String)` entityTypes) ` Sets the entity types.                                                                                             | | ` T` | ` `[setEventContext](https://developer.android.com/reference/android/view/textclassifier/TextClassifierEvent.Builder#setEventContext(android.view.textclassifier.TextClassificationContext))`(`[TextClassificationContext](https://developer.android.com/reference/android/view/textclassifier/TextClassificationContext)` eventContext) ` Sets the event context. | | ` T` | ` `[setEventIndex](https://developer.android.com/reference/android/view/textclassifier/TextClassifierEvent.Builder#setEventIndex(int))`(int eventIndex) ` Sets the index of this event in the series of events it belongs to.                                                                                                                                      | | ` T` | ` `[setExtras](https://developer.android.com/reference/android/view/textclassifier/TextClassifierEvent.Builder#setExtras(android.os.Bundle))`(`[Bundle](https://developer.android.com/reference/android/os/Bundle)` extras) ` Sets a bundle containing non-structured extra information about the event.                                                           | | ` T` | ` `[setLocale](https://developer.android.com/reference/android/view/textclassifier/TextClassifierEvent.Builder#setLocale(android.icu.util.ULocale))`(`[ULocale](https://developer.android.com/reference/android/icu/util/ULocale)` locale) ` Sets the detected locale.                                                                                             | | ` T` | ` `[setModelName](https://developer.android.com/reference/android/view/textclassifier/TextClassifierEvent.Builder#setModelName(java.lang.String))`(`[String](https://developer.android.com/reference/java/lang/String)` modelVersion) ` Sets the model name string.                                                                                                | | ` T` | ` `[setResultId](https://developer.android.com/reference/android/view/textclassifier/TextClassifierEvent.Builder#setResultId(java.lang.String))`(`[String](https://developer.android.com/reference/java/lang/String)` resultId) ` Sets the id of the text classifier result related to this event.                                                                 | | ` T` | ` `[setScores](https://developer.android.com/reference/android/view/textclassifier/TextClassifierEvent.Builder#setScores(float[]))`(float... scores) ` Sets the scores of the suggestions.                                                                                                                                                                         | ||
| From class` `[java.lang.Object](https://developer.android.com/reference/java/lang/Object)` ` |--------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` `[Object](https://developer.android.com/reference/java/lang/Object)          | ` `[clone](https://developer.android.com/reference/java/lang/Object#clone())`() ` Creates and returns a copy of this object.                                                                                                                                                      | | ` boolean`                                                                     | ` `[equals](https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object))`(`[Object](https://developer.android.com/reference/java/lang/Object)` obj) ` Indicates whether some other object is "equal to" this one.                                           | | ` void`                                                                        | ` `[finalize](https://developer.android.com/reference/java/lang/Object#finalize())`() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.                                                          | | ` final `[Class](https://developer.android.com/reference/java/lang/Class)`<?>` | ` `[getClass](https://developer.android.com/reference/java/lang/Object#getClass())`() ` Returns the runtime class of this`Object`.                                                                                                                                                | | ` int`                                                                         | ` `[hashCode](https://developer.android.com/reference/java/lang/Object#hashCode())`() ` Returns a hash code value for the object.                                                                                                                                                 | | ` final void`                                                                  | ` `[notify](https://developer.android.com/reference/java/lang/Object#notify())`() ` Wakes up a single thread that is waiting on this object's monitor.                                                                                                                            | | ` final void`                                                                  | ` `[notifyAll](https://developer.android.com/reference/java/lang/Object#notifyAll())`() ` Wakes up all threads that are waiting on this object's monitor.                                                                                                                         | | ` `[String](https://developer.android.com/reference/java/lang/String)          | ` `[toString](https://developer.android.com/reference/java/lang/Object#toString())`() ` Returns a string representation of the object.                                                                                                                                            | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long,%20int))`(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](https://developer.android.com/reference/java/lang/Object#wait(long))`(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](https://developer.android.com/reference/java/lang/Object#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](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public Builder (int eventType)
```

Creates a builder for building[TextSelectionEvent](https://developer.android.com/reference/android/view/textclassifier/TextClassifierEvent.TextSelectionEvent)s.

<br />

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Parameters                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             ||
|-------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `eventType` | `int`: The event type. e.g.[TextClassifierEvent.TYPE_SELECTION_STARTED](https://developer.android.com/reference/android/view/textclassifier/TextClassifierEvent#TYPE_SELECTION_STARTED)Value is[TextClassifierEvent.TYPE_SELECTION_STARTED](https://developer.android.com/reference/android/view/textclassifier/TextClassifierEvent#TYPE_SELECTION_STARTED),[TextClassifierEvent.TYPE_SELECTION_MODIFIED](https://developer.android.com/reference/android/view/textclassifier/TextClassifierEvent#TYPE_SELECTION_MODIFIED),[TextClassifierEvent.TYPE_SMART_SELECTION_SINGLE](https://developer.android.com/reference/android/view/textclassifier/TextClassifierEvent#TYPE_SMART_SELECTION_SINGLE),[TextClassifierEvent.TYPE_SMART_SELECTION_MULTI](https://developer.android.com/reference/android/view/textclassifier/TextClassifierEvent#TYPE_SMART_SELECTION_MULTI),[TextClassifierEvent.TYPE_AUTO_SELECTION](https://developer.android.com/reference/android/view/textclassifier/TextClassifierEvent#TYPE_AUTO_SELECTION),[TextClassifierEvent.TYPE_ACTIONS_SHOWN](https://developer.android.com/reference/android/view/textclassifier/TextClassifierEvent#TYPE_ACTIONS_SHOWN),[TextClassifierEvent.TYPE_LINK_CLICKED](https://developer.android.com/reference/android/view/textclassifier/TextClassifierEvent#TYPE_LINK_CLICKED),[TextClassifierEvent.TYPE_OVERTYPE](https://developer.android.com/reference/android/view/textclassifier/TextClassifierEvent#TYPE_OVERTYPE),[TextClassifierEvent.TYPE_COPY_ACTION](https://developer.android.com/reference/android/view/textclassifier/TextClassifierEvent#TYPE_COPY_ACTION),[TextClassifierEvent.TYPE_PASTE_ACTION](https://developer.android.com/reference/android/view/textclassifier/TextClassifierEvent#TYPE_PASTE_ACTION),[TextClassifierEvent.TYPE_CUT_ACTION](https://developer.android.com/reference/android/view/textclassifier/TextClassifierEvent#TYPE_CUT_ACTION),[TextClassifierEvent.TYPE_SHARE_ACTION](https://developer.android.com/reference/android/view/textclassifier/TextClassifierEvent#TYPE_SHARE_ACTION),[TextClassifierEvent.TYPE_SMART_ACTION](https://developer.android.com/reference/android/view/textclassifier/TextClassifierEvent#TYPE_SMART_ACTION),[TextClassifierEvent.TYPE_SELECTION_DRAG](https://developer.android.com/reference/android/view/textclassifier/TextClassifierEvent#TYPE_SELECTION_DRAG),[TextClassifierEvent.TYPE_SELECTION_DESTROYED](https://developer.android.com/reference/android/view/textclassifier/TextClassifierEvent#TYPE_SELECTION_DESTROYED),[TextClassifierEvent.TYPE_OTHER_ACTION](https://developer.android.com/reference/android/view/textclassifier/TextClassifierEvent#TYPE_OTHER_ACTION),[TextClassifierEvent.TYPE_SELECT_ALL](https://developer.android.com/reference/android/view/textclassifier/TextClassifierEvent#TYPE_SELECT_ALL),[TextClassifierEvent.TYPE_SELECTION_RESET](https://developer.android.com/reference/android/view/textclassifier/TextClassifierEvent#TYPE_SELECTION_RESET),[TextClassifierEvent.TYPE_MANUAL_REPLY](https://developer.android.com/reference/android/view/textclassifier/TextClassifierEvent#TYPE_MANUAL_REPLY),[TextClassifierEvent.TYPE_ACTIONS_GENERATED](https://developer.android.com/reference/android/view/textclassifier/TextClassifierEvent#TYPE_ACTIONS_GENERATED),[TextClassifierEvent.TYPE_LINKS_GENERATED](https://developer.android.com/reference/android/view/textclassifier/TextClassifierEvent#TYPE_LINKS_GENERATED), or android.view.textclassifier.TextClassifierEvent.TYPE_READ_CLIPBOARD <br /> |

## Public methods

### build

Added in[API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public TextClassifierEvent.TextSelectionEvent build ()
```

Builds and returns a[TextSelectionEvent](https://developer.android.com/reference/android/view/textclassifier/TextClassifierEvent.TextSelectionEvent).

<br />

|                                                                                         Returns                                                                                          ||
|------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------|
| [TextClassifierEvent.TextSelectionEvent](https://developer.android.com/reference/android/view/textclassifier/TextClassifierEvent.TextSelectionEvent) | This value cannot be`null`. <br /> |

### setRelativeSuggestedWordEndIndex

Added in[API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public TextClassifierEvent.TextSelectionEvent.Builder setRelativeSuggestedWordEndIndex (int relativeSuggestedWordEndIndex)
```

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

<br />

|                  Parameters                   ||
|---------------------------------|--------------|
| `relativeSuggestedWordEndIndex` | `int` <br /> |

|                                                                                                 Returns                                                                                                  ||
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------|
| [TextClassifierEvent.TextSelectionEvent.Builder](https://developer.android.com/reference/android/view/textclassifier/TextClassifierEvent.TextSelectionEvent.Builder) | This value cannot be`null`. <br /> |

### setRelativeSuggestedWordStartIndex

Added in[API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public TextClassifierEvent.TextSelectionEvent.Builder setRelativeSuggestedWordStartIndex (int relativeSuggestedWordStartIndex)
```

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

<br />

|                   Parameters                    ||
|-----------------------------------|--------------|
| `relativeSuggestedWordStartIndex` | `int` <br /> |

|                                                                                                 Returns                                                                                                  ||
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------|
| [TextClassifierEvent.TextSelectionEvent.Builder](https://developer.android.com/reference/android/view/textclassifier/TextClassifierEvent.TextSelectionEvent.Builder) | This value cannot be`null`. <br /> |

### setRelativeWordEndIndex

Added in[API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public TextClassifierEvent.TextSelectionEvent.Builder setRelativeWordEndIndex (int relativeWordEndIndex)
```

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

<br />

|              Parameters              ||
|------------------------|--------------|
| `relativeWordEndIndex` | `int` <br /> |

|                                                                                                 Returns                                                                                                  ||
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------|
| [TextClassifierEvent.TextSelectionEvent.Builder](https://developer.android.com/reference/android/view/textclassifier/TextClassifierEvent.TextSelectionEvent.Builder) | This value cannot be`null`. <br /> |

### setRelativeWordStartIndex

Added in[API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public TextClassifierEvent.TextSelectionEvent.Builder setRelativeWordStartIndex (int relativeWordStartIndex)
```

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

<br />

|               Parameters               ||
|--------------------------|--------------|
| `relativeWordStartIndex` | `int` <br /> |

|                                                                                                 Returns                                                                                                  ||
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------|
| [TextClassifierEvent.TextSelectionEvent.Builder](https://developer.android.com/reference/android/view/textclassifier/TextClassifierEvent.TextSelectionEvent.Builder) | This value cannot be`null`. <br /> |