# UiVersions.StylesBuilder

Artifact: [androidx.autofill:autofill](https://developer.android.com/jetpack/androidx/releases/autofill) [View Source](https://cs.android.com/search?q=file:androidx/autofill/inline/UiVersions.java+class:androidx.autofill.inline.UiVersions.StylesBuilder) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/autofill#1.1.0)

*** ** * ** ***


```
public final class UiVersions.StylesBuilder
```

<br />

*** ** * ** ***

A builder responsible for providing a `https://developer.android.com/reference/android/os/Bundle.html` with encoded UI style specifications for one or more versions of UI templates.

## Summary

| ### Public methods |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/autofill/inline/UiVersions.StylesBuilder` | `https://developer.android.com/reference/androidx/autofill/inline/UiVersions.StylesBuilder#addStyle(androidx.autofill.inline.UiVersions.Style)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/autofill/inline/UiVersions.Style style)` Adds a UI style. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/os/Bundle.html` | `https://developer.android.com/reference/androidx/autofill/inline/UiVersions.StylesBuilder#build()()` Returns the styles for one or more UI versions represented as a `https://developer.android.com/reference/android/os/Bundle.html` so it can be transported through IPC. |

## Public methods

### addStyle

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/autofill#1.1.0)

```
public @NonNull UiVersions.StylesBuilder addStyle(@NonNull UiVersions.Style style)
```

Adds a UI style.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/autofill/inline/UiVersions.Style style` | the style being added |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException.html` | if the style version is not supported by the library |

### build

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/autofill#1.1.0)

```
public @NonNull Bundle build()
```

Returns the styles for one or more UI versions represented as a `https://developer.android.com/reference/android/os/Bundle.html` so it can be transported through IPC.

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException.html` | if no style has been put in the builder |