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/TextLanguage.Builder#pubctors) \| [Methods](https://developer.android.com/reference/android/view/textclassifier/TextLanguage.Builder#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/view/textclassifier/TextLanguage.Builder#inhmethods)

# TextLanguage.Builder

*** ** * ** ***


`
public
static
final

class
TextLanguage.Builder
`


`

extends https://developer.android.com/reference/java/lang/Object


`

`


`

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

<br />

*** ** * ** ***

Builder used to build TextLanguage objects.

## Summary

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/view/textclassifier/TextLanguage.Builder#Builder()() ` |

| ### Public methods ||
|---|---|
| ` https://developer.android.com/reference/android/view/textclassifier/TextLanguage` | ` https://developer.android.com/reference/android/view/textclassifier/TextLanguage.Builder#build()() ` Builds and returns a new TextLanguage object. |
| ` https://developer.android.com/reference/android/view/textclassifier/TextLanguage.Builder` | ` https://developer.android.com/reference/android/view/textclassifier/TextLanguage.Builder#putLocale(android.icu.util.ULocale,%20float)(https://developer.android.com/reference/android/icu/util/ULocale locale, float confidenceScore) ` Sets a language locale for the processed text and assigns a confidence score. |
| ` https://developer.android.com/reference/android/view/textclassifier/TextLanguage.Builder` | ` https://developer.android.com/reference/android/view/textclassifier/TextLanguage.Builder#setExtras(android.os.Bundle)(https://developer.android.com/reference/android/os/Bundle bundle) ` Sets a bundle containing non-structured extra information about the TextLanguage object. |
| ` https://developer.android.com/reference/android/view/textclassifier/TextLanguage.Builder` | ` https://developer.android.com/reference/android/view/textclassifier/TextLanguage.Builder#setId(java.lang.String)(https://developer.android.com/reference/java/lang/String id) ` Sets an optional id for the TextLanguage object. |

| ### Inherited methods |
|---|---|
| From class ` https://developer.android.com/reference/java/lang/Object ` |---|---| | ` https://developer.android.com/reference/java/lang/Object` | ` https://developer.android.com/reference/java/lang/Object#clone()() ` Creates and returns a copy of this object. | | ` boolean` | ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) ` Indicates whether some other object is "equal to" this one. | | ` void` | ` 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 https://developer.android.com/reference/java/lang/Class<?>` | ` https://developer.android.com/reference/java/lang/Object#getClass()() ` Returns the runtime class of this `Object`. | | ` int` | ` https://developer.android.com/reference/java/lang/Object#hashCode()() ` Returns a hash code value for the object. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#notify()() ` Wakes up a single thread that is waiting on this object's monitor. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#notifyAll()() ` Wakes up all threads that are waiting on this object's monitor. | | ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/java/lang/Object#toString()() ` Returns a string representation of the object. | | ` final void` | ` 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` | ` 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` | ` 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

```
public Builder ()
```

<br />

<br />

## Public methods

### build

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

```
public TextLanguage build ()
```

Builds and returns a new TextLanguage object.


If necessary, this method will verify fields, clamp them, and make them immutable.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/view/textclassifier/TextLanguage` | This value cannot be `null`. <br /> |

### putLocale

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

```
public TextLanguage.Builder putLocale (ULocale locale, 
                float confidenceScore)
```

Sets a language locale for the processed text and assigns a confidence score. If the
locale has already been set, this updates it.

<br />

| Parameters ||
|---|---|
| `locale` | `ULocale`: This value cannot be `null`. <br /> |
| `confidenceScore` | `float`: a value from 0 (low confidence) to 1 (high confidence). 0 implies the locale does not exist for the processed text. Values greater than 1 are clamped to 1. Value is between 0.0f and 1.0f inclusive <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/view/textclassifier/TextLanguage.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 TextLanguage.Builder setExtras (Bundle bundle)
```

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

<br />

| Parameters ||
|---|---|
| `bundle` | `Bundle`: This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/view/textclassifier/TextLanguage.Builder` | This value cannot be `null`. <br /> |

### setId

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

```
public TextLanguage.Builder setId (String id)
```

Sets an optional id for the TextLanguage object.

<br />

| Parameters ||
|---|---|
| `id` | `String`: This value may be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/view/textclassifier/TextLanguage.Builder` | This value cannot be `null`. <br /> |