# Field.Builder

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

# Builder

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/android/service/autofill/Field.Builder "View this page in Java")  

```
class Builder
```

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

A builder for[Field](https://developer.android.com/reference/kotlin/android/service/autofill/Field)

## Summary

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

|                                                                                                                                                                                                                                                                                          Public methods                                                                                                                                                                                                                                                                                           ||
|---------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Field](https://developer.android.com/reference/kotlin/android/service/autofill/Field)                  | [build](https://developer.android.com/reference/kotlin/android/service/autofill/Field.Builder#build())`()` Builds the instance.                                                                                                                                                                                                                                                                                                                                                          |
| [Field.Builder](https://developer.android.com/reference/kotlin/android/service/autofill/Field.Builder#) | [setFilter](https://developer.android.com/reference/kotlin/android/service/autofill/Field.Builder#setFilter(java.util.regex.Pattern))`(`value:` `[Pattern](https://developer.android.com/reference/kotlin/java/util/regex/Pattern.html#)?`)` Regex used to determine if the dataset should be shown in the autofill UI; when`null`, it disables filtering on that dataset (this is the recommended approach when`value`is not`null`and field contains sensitive data such as passwords). |
| [Field.Builder](https://developer.android.com/reference/kotlin/android/service/autofill/Field.Builder#) | [setPresentations](https://developer.android.com/reference/kotlin/android/service/autofill/Field.Builder#setPresentations(android.service.autofill.Presentations))`(`value:` `[Presentations](https://developer.android.com/reference/kotlin/android/service/autofill/Presentations)`)` The presentations used to visualize this field in Autofill UI.                                                                                                                                   |
| [Field.Builder](https://developer.android.com/reference/kotlin/android/service/autofill/Field.Builder#) | [setValue](https://developer.android.com/reference/kotlin/android/service/autofill/Field.Builder#setValue(android.view.autofill.AutofillValue))`(`value:` `[AutofillValue](https://developer.android.com/reference/kotlin/android/view/autofill/AutofillValue.html#)`)` The value to be autofilled.                                                                                                                                                                                      |

## Public constructors

### Builder

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

```
Builder()
```

## Public methods

### build

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

```
fun build(): Field
```

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

|                                                       Return                                                        ||
|----------------------------------------------------------------------------------------|-----------------------------|
| [Field](https://developer.android.com/reference/kotlin/android/service/autofill/Field) | This value cannot be`null`. |

### setFilter

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

```
fun setFilter(value: Pattern?): Field.Builder
```

Regex used to determine if the dataset should be shown in the autofill UI; when`null`, it disables filtering on that dataset (this is the recommended approach when`value`is not`null`and field contains sensitive data such as passwords).

|                                                         Parameters                                                         ||
|---------|-------------------------------------------------------------------------------------------------------------------|
| `value` | [Pattern](https://developer.android.com/reference/kotlin/java/util/regex/Pattern.html#)?:This value may be`null`. |

### setPresentations

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

```
fun setPresentations(value: Presentations): Field.Builder
```

The presentations used to visualize this field in Autofill UI.

|                                                                 Parameters                                                                  ||
|---------|------------------------------------------------------------------------------------------------------------------------------------|
| `value` | [Presentations](https://developer.android.com/reference/kotlin/android/service/autofill/Presentations):This value cannot be`null`. |

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

### setValue

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

```
fun setValue(value: AutofillValue): Field.Builder
```

The value to be autofilled. Pass`null`if you do not have the value but the target view is a logical part of the dataset. For example, if the dataset needs authentication and you have no access to the value.

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