# TextClassification.Request.Builder

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

# Builder

*** ** * ** ***

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

```
class Builder
```

|---|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)                                                                                                   ||
| ↳ | [android.view.textclassifier.TextClassification.Request.Builder](https://developer.android.com/reference/kotlin/android/view/textclassifier/TextClassification.Request.Builder#) |

A builder for building TextClassification requests.

## Summary

|                                                                                                                                                                                                                                     Public constructors                                                                                                                                                                                                                                      ||
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [Builder](https://developer.android.com/reference/kotlin/android/view/textclassifier/TextClassification.Request.Builder#Builder(kotlin.CharSequence,%20kotlin.Int,%20kotlin.Int))`(`text:` `[CharSequence](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-sequence/index.html)`, `startIndex:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `endIndex:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` <br /> |

|                                                                                                                                                                                                                        Public methods                                                                                                                                                                                                                         ||
|------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [TextClassification.Request](https://developer.android.com/reference/kotlin/android/view/textclassifier/TextClassification.Request)                  | [build](https://developer.android.com/reference/kotlin/android/view/textclassifier/TextClassification.Request.Builder#build())`()` Builds and returns the request object.                                                                                                                               |
| [TextClassification.Request.Builder](https://developer.android.com/reference/kotlin/android/view/textclassifier/TextClassification.Request.Builder#) | [setDefaultLocales](https://developer.android.com/reference/kotlin/android/view/textclassifier/TextClassification.Request.Builder#setDefaultLocales(android.os.LocaleList))`(`defaultLocales:` `[LocaleList](https://developer.android.com/reference/kotlin/android/os/LocaleList.html#)?`)` <br />     |
| [TextClassification.Request.Builder](https://developer.android.com/reference/kotlin/android/view/textclassifier/TextClassification.Request.Builder#) | [setExtras](https://developer.android.com/reference/kotlin/android/view/textclassifier/TextClassification.Request.Builder#setExtras(android.os.Bundle))`(`extras:` `[Bundle](https://developer.android.com/reference/kotlin/android/os/Bundle.html#)?`)` Sets the extended data.                        |
| [TextClassification.Request.Builder](https://developer.android.com/reference/kotlin/android/view/textclassifier/TextClassification.Request.Builder#) | [setReferenceTime](https://developer.android.com/reference/kotlin/android/view/textclassifier/TextClassification.Request.Builder#setReferenceTime(java.time.ZonedDateTime))`(`referenceTime:` `[ZonedDateTime](https://developer.android.com/reference/kotlin/java/time/ZonedDateTime.html#)?`)` <br /> |

## Public constructors

### Builder

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

```
Builder(
    text: CharSequence, 
    startIndex: Int, 
    endIndex: Int)
```

|                                                                                                                                   Parameters                                                                                                                                   ||
|--------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `text`       | [CharSequence](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-sequence/index.html):text providing context for the text to classify (which is specified by the sub sequence starting at startIndex and ending at endIndex) This value cannot be`null`. |
| `startIndex` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):start index of the text to classify Value is 0 or greater                                                                                                                             |
| `endIndex`   | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):end index of the text to classify Value is 0 or greater                                                                                                                               |

## Public methods

### build

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

```
fun build(): TextClassification.Request
```

Builds and returns the request object.

|                                                                              Return                                                                              ||
|-------------------------------------------------------------------------------------------------------------------------------------|-----------------------------|
| [TextClassification.Request](https://developer.android.com/reference/kotlin/android/view/textclassifier/TextClassification.Request) | This value cannot be`null`. |

### setDefaultLocales

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

```
fun setDefaultLocales(defaultLocales: LocaleList?): TextClassification.Request.Builder
```

|                                                                                                                                  Parameters                                                                                                                                  ||
|------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `defaultLocales` | [LocaleList](https://developer.android.com/reference/kotlin/android/os/LocaleList.html#)?: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. |

|                                                                                             Return                                                                                             ||
|------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------|
| [TextClassification.Request.Builder](https://developer.android.com/reference/kotlin/android/view/textclassifier/TextClassification.Request.Builder#) | this builder This value cannot be`null`. |

### setExtras

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

```
fun setExtras(extras: Bundle?): TextClassification.Request.Builder
```

Sets the extended data.

|                                                      Parameters                                                      ||
|----------|------------------------------------------------------------------------------------------------------------|
| `extras` | [Bundle](https://developer.android.com/reference/kotlin/android/os/Bundle.html#)?:This value may be`null`. |

|                                                                                             Return                                                                                             ||
|------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------|
| [TextClassification.Request.Builder](https://developer.android.com/reference/kotlin/android/view/textclassifier/TextClassification.Request.Builder#) | this builder This value cannot be`null`. |

### setReferenceTime

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

```
fun setReferenceTime(referenceTime: ZonedDateTime?): TextClassification.Request.Builder
```

|                                                                                                                                                                   Parameters                                                                                                                                                                   ||
|-----------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `referenceTime` | [ZonedDateTime](https://developer.android.com/reference/kotlin/java/time/ZonedDateTime.html#)?:reference time based on which relative dates (e.g. "tomorrow" should be interpreted. This should usually be the time when the text was originally composed. If no reference time is set, now is used. This value may be`null`. |

|                                                                                             Return                                                                                             ||
|------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------|
| [TextClassification.Request.Builder](https://developer.android.com/reference/kotlin/android/view/textclassifier/TextClassification.Request.Builder#) | this builder This value cannot be`null`. |