# TextSelection.Request.Builder

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

# TextSelection.Request.Builder

*** ** * ** ***

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

`
public
static
final

class
TextSelection.Request.Builder
`  
`

extends `[Object](https://developer.android.com/reference/java/lang/Object)`


``


`

|---|-----------------------------------------------------------|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.view.textclassifier.TextSelection.Request.Builder |

<br />

*** ** * ** ***

A builder for building TextSelection requests.

## Summary

|                                                                                                                                 ### Public constructors                                                                                                                                  ||
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| ` `[Builder](https://developer.android.com/reference/android/view/textclassifier/TextSelection.Request.Builder#Builder(java.lang.CharSequence,%20int,%20int))`(`[CharSequence](https://developer.android.com/reference/java/lang/CharSequence)` text, int startIndex, int endIndex) ` |

|                                                                                                                                                                                             ### Public methods                                                                                                                                                                                             ||
|---------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` `[TextSelection.Request](https://developer.android.com/reference/android/view/textclassifier/TextSelection.Request)                 | ` `[build](https://developer.android.com/reference/android/view/textclassifier/TextSelection.Request.Builder#build())`() ` Builds and returns the request object.                                                                                                   |
| ` `[TextSelection.Request.Builder](https://developer.android.com/reference/android/view/textclassifier/TextSelection.Request.Builder) | ` `[setDefaultLocales](https://developer.android.com/reference/android/view/textclassifier/TextSelection.Request.Builder#setDefaultLocales(android.os.LocaleList))`(`[LocaleList](https://developer.android.com/reference/android/os/LocaleList)` defaultLocales) ` |
| ` `[TextSelection.Request.Builder](https://developer.android.com/reference/android/view/textclassifier/TextSelection.Request.Builder) | ` `[setExtras](https://developer.android.com/reference/android/view/textclassifier/TextSelection.Request.Builder#setExtras(android.os.Bundle))`(`[Bundle](https://developer.android.com/reference/android/os/Bundle)` extras) ` Sets the extended data.             |
| ` `[TextSelection.Request.Builder](https://developer.android.com/reference/android/view/textclassifier/TextSelection.Request.Builder) | ` `[setIncludeTextClassification](https://developer.android.com/reference/android/view/textclassifier/TextSelection.Request.Builder#setIncludeTextClassification(boolean))`(boolean includeTextClassification) `                                                    |

| ### Inherited methods |
|-----------------------|---|
| 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 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public Builder (CharSequence text, 
                int startIndex, 
                int endIndex)
```

<br />

<br />

|                                                                                                       Parameters                                                                                                       ||
|--------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `text`       | `CharSequence`: text providing context for the selected text (which is specified by the sub sequence starting at selectionStartIndex and ending at selectionEndIndex) This value cannot be`null`. <br /> |
| `startIndex` | `int`: start index of the selected part of text Value is 0 or greater <br />                                                                                                                             |
| `endIndex`   | `int`: end index of the selected part of text Value is 0 or greater <br />                                                                                                                               |

## Public methods

### build

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

```
public TextSelection.Request build ()
```

Builds and returns the request object.

<br />

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

### setDefaultLocales

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

```
public TextSelection.Request.Builder setDefaultLocales (LocaleList defaultLocales)
```

<br />

<br />

|                                                                                               Parameters                                                                                                ||
|------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `defaultLocales` | `LocaleList`: ordered list of locale preferences that may be used to disambiguate the provided text. If no locale preferences exist, set this to null or an empty locale list. <br /> |

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

### setExtras

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

```
public TextSelection.Request.Builder setExtras (Bundle extras)
```

Sets the extended data.

<br />

|                     Parameters                      ||
|----------|-------------------------------------------|
| `extras` | `Bundle`: This value may be`null`. <br /> |

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

### setIncludeTextClassification

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

```
public TextSelection.Request.Builder setIncludeTextClassification (boolean includeTextClassification)
```

<br />

<br />

|                                                                                                                                                                                                         Parameters                                                                                                                                                                                                         ||
|-----------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `includeTextClassification` | `boolean`: If true, suggests the TextClassifier to classify the text in the suggested selection span and include a TextClassification object in the result. The TextClassifier may not support this and in which case,[TextSelection.getTextClassification()](https://developer.android.com/reference/android/view/textclassifier/TextSelection#getTextClassification())returns`null`. <br /> |

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

**See also:**

- [TextSelection.getTextClassification()](https://developer.android.com/reference/android/view/textclassifier/TextSelection#getTextClassification())