# TranslationResponseValue.Builder

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

# Builder

*** ** * ** ***

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

```
class Builder
```

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

A builder for[TranslationResponseValue](https://developer.android.com/reference/kotlin/android/view/translation/TranslationResponseValue)

## Summary

|                                                                                                                       Public constructors                                                                                                                       ||
|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [Builder](https://developer.android.com/reference/kotlin/android/view/translation/TranslationResponseValue.Builder#Builder(kotlin.Int))`(`statusCode:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Creates a new Builder. |

|                                                                                                                                                                                                                                    Public methods                                                                                                                                                                                                                                    ||
|-----------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [TranslationResponseValue](https://developer.android.com/reference/kotlin/android/view/translation/TranslationResponseValue)                  | [build](https://developer.android.com/reference/kotlin/android/view/translation/TranslationResponseValue.Builder#build())`()` Builds the instance.                                                                                                                                                                                    |
| [TranslationResponseValue.Builder](https://developer.android.com/reference/kotlin/android/view/translation/TranslationResponseValue.Builder#) | [setExtras](https://developer.android.com/reference/kotlin/android/view/translation/TranslationResponseValue.Builder#setExtras(android.os.Bundle))`(`value:` `[Bundle](https://developer.android.com/reference/kotlin/android/os/Bundle.html#)`)` Extra results associated with the translated text.                                  |
| [TranslationResponseValue.Builder](https://developer.android.com/reference/kotlin/android/view/translation/TranslationResponseValue.Builder#) | [setText](https://developer.android.com/reference/kotlin/android/view/translation/TranslationResponseValue.Builder#setText(kotlin.CharSequence))`(`value:` `[CharSequence](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-sequence/index.html)`)` The translated text result.                                              |
| [TranslationResponseValue.Builder](https://developer.android.com/reference/kotlin/android/view/translation/TranslationResponseValue.Builder#) | [setTransliteration](https://developer.android.com/reference/kotlin/android/view/translation/TranslationResponseValue.Builder#setTransliteration(kotlin.CharSequence))`(`value:` `[CharSequence](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-sequence/index.html)`)` The transliteration result of the translated text. |

## Public constructors

### Builder

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

```
Builder(statusCode: Int)
```

Creates a new Builder.

|                                                                                                                                                                                                                                                                                                                                                                                                                                  Parameters                                                                                                                                                                                                                                                                                                                                                                                                                                  ||
|--------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `statusCode` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):The status code of this[TranslationResponseValue](https://developer.android.com/reference/kotlin/android/view/translation/TranslationResponseValue). If the status code is[STATUS_ERROR](https://developer.android.com/reference/kotlin/android/view/translation/TranslationResponseValue#STATUS_ERROR:kotlin.Int), no values are attached, and all getters will return`null`. Value is[android.view.translation.TranslationResponseValue#STATUS_SUCCESS](https://developer.android.com/reference/kotlin/android/view/translation/TranslationResponseValue#STATUS_SUCCESS:kotlin.Int), or[android.view.translation.TranslationResponseValue#STATUS_ERROR](https://developer.android.com/reference/kotlin/android/view/translation/TranslationResponseValue#STATUS_ERROR:kotlin.Int) |

## Public methods

### build

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

```
fun build(): TranslationResponseValue
```

Builds the instance. This builder should not be touched after calling this!

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

### setExtras

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

```
fun setExtras(value: Bundle): TranslationResponseValue.Builder
```

Extra results associated with the translated text.

The bundle includes[EXTRA_DEFINITIONS](https://developer.android.com/reference/kotlin/android/view/translation/TranslationResponseValue#EXTRA_DEFINITIONS:kotlin.String), obtained by[Bundle.getBundle](https://developer.android.com/reference/kotlin/android/os/Bundle.html#getBundle(kotlin.String)).

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

|                                                                                   Return                                                                                   ||
|-----------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------|
| [TranslationResponseValue.Builder](https://developer.android.com/reference/kotlin/android/view/translation/TranslationResponseValue.Builder#) | This value cannot be`null`. |

### setText

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

```
fun setText(value: CharSequence): TranslationResponseValue.Builder
```

The translated text result.

|                                                             Parameters                                                             ||
|---------|---------------------------------------------------------------------------------------------------------------------------|
| `value` | [CharSequence](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-sequence/index.html):This value cannot be`null`. |

|                                                                                   Return                                                                                   ||
|-----------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------|
| [TranslationResponseValue.Builder](https://developer.android.com/reference/kotlin/android/view/translation/TranslationResponseValue.Builder#) | This value cannot be`null`. |

### setTransliteration

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

```
fun setTransliteration(value: CharSequence): TranslationResponseValue.Builder
```

The transliteration result of the translated text.

This returns a CharSequence representation of the transliteration of the translated text.

|                                                             Parameters                                                             ||
|---------|---------------------------------------------------------------------------------------------------------------------------|
| `value` | [CharSequence](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-sequence/index.html):This value cannot be`null`. |

|                                                                                   Return                                                                                   ||
|-----------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------|
| [TranslationResponseValue.Builder](https://developer.android.com/reference/kotlin/android/view/translation/TranslationResponseValue.Builder#) | This value cannot be`null`. |