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/ViewTranslationRequest.Builder "View this page in Java")

```
class Builder
```

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

A builder for building ViewTranslationRequest.

## Summary

| Public constructors ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/view/translation/ViewTranslationRequest.Builder#Builder(android.view.autofill.AutofillId)(autofillId: https://developer.android.com/reference/kotlin/android/view/autofill/AutofillId.html#)` Creates a new Builder. |
| `https://developer.android.com/reference/kotlin/android/view/translation/ViewTranslationRequest.Builder#Builder(android.view.autofill.AutofillId,%20kotlin.Long)(autofillId: https://developer.android.com/reference/kotlin/android/view/autofill/AutofillId.html#, virtualChildId: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html)` Creates a new Builder. |

| Public methods ||
|---|---|
| [ViewTranslationRequest](https://developer.android.com/reference/kotlin/android/view/translation/ViewTranslationRequest) | `https://developer.android.com/reference/kotlin/android/view/translation/ViewTranslationRequest.Builder#build()()` Builds the instance. |
| [ViewTranslationRequest.Builder](https://developer.android.com/reference/kotlin/android/view/translation/ViewTranslationRequest.Builder#) | `https://developer.android.com/reference/kotlin/android/view/translation/ViewTranslationRequest.Builder#setValue(kotlin.String,%20android.view.translation.TranslationRequestValue)(key: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html, value: https://developer.android.com/reference/kotlin/android/view/translation/TranslationRequestValue)` Sets the corresponding `https://developer.android.com/reference/kotlin/android/view/translation/TranslationRequestValue` for the provided key. |

## Public constructors

### Builder

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

```
Builder(autofillId: AutofillId)
```

Creates a new Builder.

| Parameters ||
|---|---|
| `autofillId` | [AutofillId](https://developer.android.com/reference/kotlin/android/view/autofill/AutofillId.html#): The `https://developer.android.com/reference/kotlin/android/view/autofill/AutofillId.html#` of the view associated with this request. This value cannot be `null`. |

### Builder

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

```
Builder(
    autofillId: AutofillId, 
    virtualChildId: Long)
```

Creates a new Builder.

| Parameters ||
|---|---|
| `autofillId` | [AutofillId](https://developer.android.com/reference/kotlin/android/view/autofill/AutofillId.html#): the `https://developer.android.com/reference/kotlin/android/view/autofill/AutofillId.html#` of the non-virtual view hosting the virtual view hierarchy associated with this request. This value cannot be `null`. |
| `virtualChildId` | [Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html): the id of the virtual view in the host view. This id is the same virtual id provided through content capture. |

## Public methods

### build

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

```
fun build(): ViewTranslationRequest
```

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

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/view/translation/ViewTranslationRequest` | This value cannot be `null`. |

### setValue

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

```
fun setValue(
    key: String, 
    value: TranslationRequestValue
): ViewTranslationRequest.Builder
```

Sets the corresponding `https://developer.android.com/reference/kotlin/android/view/translation/TranslationRequestValue` for the provided key.

| Parameters ||
|---|---|
| `key` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): The key for this translation request value. This value cannot be `null`. |
| `value` | [TranslationRequestValue](https://developer.android.com/reference/kotlin/android/view/translation/TranslationRequestValue): the translation request value holding the content to be translated. This value cannot be `null`. |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/view/translation/ViewTranslationRequest.Builder#` | this builder. This value cannot be `null`. |