# BatchUpdates.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/service/autofill/BatchUpdates.Builder "View this page in Java")  

```
class Builder
```

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

Builder for[BatchUpdates](https://developer.android.com/reference/kotlin/android/service/autofill/BatchUpdates)objects.

## Summary

|                                                       Public constructors                                                       ||
|------------------------------------------------------------------------------------------------------------------------------|---|
| [Builder](https://developer.android.com/reference/kotlin/android/service/autofill/BatchUpdates.Builder#Builder())`()` <br /> |

|                                                                                                                                                                                                                                                                                                         Public methods                                                                                                                                                                                                                                                                                                         ||
|----------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| open[BatchUpdates](https://developer.android.com/reference/kotlin/android/service/autofill/BatchUpdates)!                  | [build](https://developer.android.com/reference/kotlin/android/service/autofill/BatchUpdates.Builder#build())`()` Creates a new[BatchUpdates](https://developer.android.com/reference/kotlin/android/service/autofill/BatchUpdates)instance.                                                                                                                                                                                                                                                       |
| open[BatchUpdates.Builder](https://developer.android.com/reference/kotlin/android/service/autofill/BatchUpdates.Builder#)! | [transformChild](https://developer.android.com/reference/kotlin/android/service/autofill/BatchUpdates.Builder#transformChild(kotlin.Int,%20android.service.autofill.Transformation))`(`id:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `transformation:` `[Transformation](https://developer.android.com/reference/kotlin/android/service/autofill/Transformation)`)` Adds a transformation to replace the value of a child view with the fields in the screen. |
| open[BatchUpdates.Builder](https://developer.android.com/reference/kotlin/android/service/autofill/BatchUpdates.Builder#)! | [updateTemplate](https://developer.android.com/reference/kotlin/android/service/autofill/BatchUpdates.Builder#updateTemplate(android.widget.RemoteViews))`(`updates:` `[RemoteViews](https://developer.android.com/reference/kotlin/android/widget/RemoteViews.html#)`)` Applies the`updates`in the underlying presentation template.                                                                                                                                                              |

## Public constructors

### Builder

```
Builder()
```

## Public methods

### build

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

```
open fun build(): BatchUpdates!
```

Creates a new[BatchUpdates](https://developer.android.com/reference/kotlin/android/service/autofill/BatchUpdates)instance.

|                                                                                                                                                                                                                                                                                                            Exceptions                                                                                                                                                                                                                                                                                                             ||
|-----------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `java.lang.IllegalStateException` | if[build()](https://developer.android.com/reference/kotlin/android/service/autofill/BatchUpdates.Builder#build())was already called before or no call to[updateTemplate(android.widget.RemoteViews)](https://developer.android.com/reference/kotlin/android/service/autofill/BatchUpdates.Builder#updateTemplate(android.widget.RemoteViews))or[transformChild(int,android.service.autofill.Transformation)](https://developer.android.com/reference/kotlin/android/service/autofill/BatchUpdates.Builder#transformChild(kotlin.Int,%20android.service.autofill.Transformation))has been made. |

### transformChild

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

```
open fun transformChild(
    id: Int, 
    transformation: Transformation
): BatchUpdates.Builder!
```

Adds a transformation to replace the value of a child view with the fields in the screen.

When multiple transformations are added for the same child view, they are applied in the same order as added.

**Note:** The transformations are applied after the[updates](https://developer.android.com/reference/kotlin/android/service/autofill/BatchUpdates.Builder#updateTemplate(android.widget.RemoteViews))are applied to the presentation template.

|                                                                                                Parameters                                                                                                ||
|------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `id`             | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):view id of the children view.                                                                               |
| `transformation` | [Transformation](https://developer.android.com/reference/kotlin/android/service/autofill/Transformation):an implementation provided by the Android System. This value cannot be`null`. |

|                                                                Return                                                                 ||
|------------------------------------------------------------------------------------------------------------------------|---------------|
| [BatchUpdates.Builder](https://developer.android.com/reference/kotlin/android/service/autofill/BatchUpdates.Builder#)! | this builder. |

|                                               Exceptions                                               ||
|--------------------------------------|------------------------------------------------------------------|
| `java.lang.IllegalArgumentException` | if`transformation`is not a class provided by the Android System. |

### updateTemplate

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

```
open fun updateTemplate(updates: RemoteViews): BatchUpdates.Builder!
```

Applies the`updates`in the underlying presentation template.

**Note:** The updates are applied before the[transformations](https://developer.android.com/reference/kotlin/android/service/autofill/BatchUpdates.Builder#transformChild(kotlin.Int,%20android.service.autofill.Transformation))are applied to the children views.

Theme does not work with RemoteViews layout. Avoid hardcoded text color or background color: Autofill on different platforms may have different themes.

|                                                                                                                                                      Parameters                                                                                                                                                      ||
|-----------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `updates` | [RemoteViews](https://developer.android.com/reference/kotlin/android/widget/RemoteViews.html#):a[RemoteViews](https://developer.android.com/reference/kotlin/android/widget/RemoteViews.html#)with the updated actions to be applied in the underlying presentation template. This value cannot be`null`. |

|                                                                Return                                                                ||
|------------------------------------------------------------------------------------------------------------------------|--------------|
| [BatchUpdates.Builder](https://developer.android.com/reference/kotlin/android/service/autofill/BatchUpdates.Builder#)! | this builder |

|                                            Exceptions                                             ||
|--------------------------------------|-------------------------------------------------------------|
| `java.lang.IllegalArgumentException` | if`condition`is not a class provided by the Android System. |