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

# Builder

*** ** * ** ***

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

```
class Builder
```

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

Builder for `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse` objects. You must to provide at least one dataset or set an authentication intent with a presentation view.

## Summary

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

| Public methods ||
|---|---|
| [FillResponse.Builder](https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#) | `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#addDataset(android.service.autofill.Dataset)(dataset: https://developer.android.com/reference/kotlin/android/service/autofill/Dataset?)` Adds a new `https://developer.android.com/reference/kotlin/android/service/autofill/Dataset` to this response. |
| [FillResponse](https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse) | `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#build()()` Builds a new `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse` instance. |
| [FillResponse.Builder](https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#) | `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#disableAutofill(kotlin.Long)(duration: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html)` Disables autofill for the app or activity. |
| [FillResponse.Builder](https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#) | `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#setAuthentication(kotlin.Array,%20android.content.IntentSender,%20android.service.autofill.Presentations)(ids: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html<https://developer.android.com/reference/kotlin/android/view/autofill/AutofillId.html#!>, authentication: https://developer.android.com/reference/kotlin/android/content/IntentSender.html#?, presentations: https://developer.android.com/reference/kotlin/android/service/autofill/Presentations?)` Triggers a custom UI before autofilling the screen with any data set in this response. |
| [FillResponse.Builder](https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#) | `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#setAuthentication(kotlin.Array,%20android.content.IntentSender,%20android.widget.RemoteViews)(ids: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html<https://developer.android.com/reference/kotlin/android/view/autofill/AutofillId.html#!>, authentication: https://developer.android.com/reference/kotlin/android/content/IntentSender.html#?, presentation: https://developer.android.com/reference/kotlin/android/widget/RemoteViews.html#?)` Triggers a custom UI before autofilling the screen with any data set in this response. |
| [FillResponse.Builder](https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#) | `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#setAuthentication(kotlin.Array,%20android.content.IntentSender,%20android.widget.RemoteViews,%20android.service.autofill.InlinePresentation)(ids: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html<https://developer.android.com/reference/kotlin/android/view/autofill/AutofillId.html#!>, authentication: https://developer.android.com/reference/kotlin/android/content/IntentSender.html#?, presentation: https://developer.android.com/reference/kotlin/android/widget/RemoteViews.html#?, inlinePresentation: https://developer.android.com/reference/kotlin/android/service/autofill/InlinePresentation?)` Triggers a custom UI before autofilling the screen with any data set in this response. |
| [FillResponse.Builder](https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#) | `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#setAuthentication(kotlin.Array,%20android.content.IntentSender,%20android.widget.RemoteViews,%20android.service.autofill.InlinePresentation,%20android.service.autofill.InlinePresentation)(ids: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html<https://developer.android.com/reference/kotlin/android/view/autofill/AutofillId.html#!>, authentication: https://developer.android.com/reference/kotlin/android/content/IntentSender.html#?, presentation: https://developer.android.com/reference/kotlin/android/widget/RemoteViews.html#?, inlinePresentation: https://developer.android.com/reference/kotlin/android/service/autofill/InlinePresentation?, inlineTooltipPresentation: https://developer.android.com/reference/kotlin/android/service/autofill/InlinePresentation?)` Triggers a custom UI before autofilling the screen with any data set in this response. |
| [FillResponse.Builder](https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#) | `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#setClientState(android.os.Bundle)(clientState: https://developer.android.com/reference/kotlin/android/os/Bundle.html#?)` Sets a bundle with state that is passed to subsequent APIs that manipulate this response. |
| [FillResponse.Builder](https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#) | `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#setDetectedFieldClassifications(kotlin.collections.MutableSet)(fieldInfos: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-set/index.html<https://developer.android.com/reference/kotlin/android/service/assist/classification/FieldClassification.html#!>)` Adds a new `https://developer.android.com/reference/kotlin/android/service/assist/classification/FieldClassification.html#` to this response, to help the platform provide more accurate detection results. |
| [FillResponse.Builder](https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#) | `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#setDialogHeader(android.widget.RemoteViews)(header: https://developer.android.com/reference/kotlin/android/widget/RemoteViews.html#)` Sets the presentation of header in fill dialog UI. |
| [FillResponse.Builder](https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#) | `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#setFieldClassificationIds(android.view.autofill.AutofillId)(vararg ids: https://developer.android.com/reference/kotlin/android/view/autofill/AutofillId.html#!)` Sets which fields are used for [field classification](https://developer.android.com/reference/kotlin/android/service/autofill/AutofillService#FieldClassification) |
| [FillResponse.Builder](https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#) | `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#setFillDialogTriggerIds(android.view.autofill.AutofillId)(vararg ids: https://developer.android.com/reference/kotlin/android/view/autofill/AutofillId.html#!)` Sets which fields are used for the fill dialog UI. |
| [FillResponse.Builder](https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#) | `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#setFlags(kotlin.Int)(flags: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Sets flags changing the response behavior. |
| [FillResponse.Builder](https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#) | `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#setFooter(android.widget.RemoteViews)(footer: https://developer.android.com/reference/kotlin/android/widget/RemoteViews.html#)` Sets a footer to be shown as the last element in the list of datasets. |
| [FillResponse.Builder](https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#) | `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#setHeader(android.widget.RemoteViews)(header: https://developer.android.com/reference/kotlin/android/widget/RemoteViews.html#)` Sets a header to be shown as the first element in the list of datasets. |
| [FillResponse.Builder](https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#) | `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#setIconResourceId(kotlin.Int)(id: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Overwrites Save/Fill dialog header icon with a specific one specified by resource id. |
| [FillResponse.Builder](https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#) | `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#setIgnoredIds(android.view.autofill.AutofillId)(vararg ids: https://developer.android.com/reference/kotlin/android/view/autofill/AutofillId.html#!)` Specifies views that should not trigger new `https://developer.android.com/reference/kotlin/android/service/autofill/AutofillService#onFillRequest(android.service.autofill.FillRequest,%20android.os.CancellationSignal,%20android.service.autofill.FillCallback)` requests. |
| [FillResponse.Builder](https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#) | `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#setPresentationCancelIds(kotlin.IntArray)(ids: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int-array/index.html?)` Sets target resource IDs of the child view in `https://developer.android.com/reference/kotlin/android/widget/RemoteViews.html#` which will cancel the session when clicked. |
| [FillResponse.Builder](https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#) | `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#setSaveInfo(android.service.autofill.SaveInfo)(saveInfo: https://developer.android.com/reference/kotlin/android/service/autofill/SaveInfo)` Sets the `https://developer.android.com/reference/kotlin/android/service/autofill/SaveInfo` associated with this response. |
| [FillResponse.Builder](https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#) | `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#setServiceDisplayNameResourceId(kotlin.Int)(id: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Overrides the service name in the Save Dialog header with a specific string defined in the service provider's manifest. |
| [FillResponse.Builder](https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#) | `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#setShowFillDialogIcon(kotlin.Boolean)(show: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)` Whether or not to show the Autofill provider icon inside of the Fill Dialog |
| [FillResponse.Builder](https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#) | `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#setShowSaveDialogIcon(kotlin.Boolean)(show: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)` Whether or not to show the Autofill provider icon inside of the Save Dialog |
| [FillResponse.Builder](https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#) | `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#setUserData(android.service.autofill.UserData)(userData: https://developer.android.com/reference/kotlin/android/service/autofill/UserData)` Sets a specific `https://developer.android.com/reference/kotlin/android/service/autofill/UserData` for field classification for this request only. |

## Public constructors

### Builder

```
Builder()
```

## Public methods

### addDataset

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

```
fun addDataset(dataset: Dataset?): FillResponse.Builder
```

Adds a new `https://developer.android.com/reference/kotlin/android/service/autofill/Dataset` to this response.

**Note:** on Android `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#O:kotlin.Int`, the total number of datasets is limited by the Binder transaction size, so it's recommended to keep it small (in the range of 10-20 at most) and use pagination by adding a fake `https://developer.android.com/reference/kotlin/android/service/autofill/Dataset.Builder#setAuthentication(android.content.IntentSender)` at the end with a presentation string like "Next 10" that would return a new `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse` with the next 10 datasets, and so on. This limitation was lifted on Android `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#O_MR1:kotlin.Int`, although the Binder transaction size can still be reached if each dataset itself is too big.

| Parameters ||
|---|---|
| `dataset` | [Dataset](https://developer.android.com/reference/kotlin/android/service/autofill/Dataset)?: This value may be `null`. |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#` | This builder. This value cannot be `null`. |

### build

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

```
fun build(): FillResponse
```

Builds a new `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse` instance.

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse` | A built response. This value cannot be `null`. |

| Exceptions ||
|---|---|
| `java.lang.IllegalStateException` | if any of the following conditions occur: 1. `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#build()` was already called. 2. No call was made to `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#addDataset(android.service.autofill.Dataset)`, `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#setAuthentication(kotlin.Array,%20android.content.IntentSender,%20android.service.autofill.Presentations)`, `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#setSaveInfo(android.service.autofill.SaveInfo)`, `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#disableAutofill(kotlin.Long)`, `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#setClientState(android.os.Bundle)`, or `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#setFieldClassificationIds(android.view.autofill.AutofillId)`. 3. `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#setHeader(android.widget.RemoteViews)` or `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#setFooter(android.widget.RemoteViews)` is called without any previous calls to `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#addDataset(android.service.autofill.Dataset)`. |

### disableAutofill

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

```
fun disableAutofill(duration: Long): FillResponse.Builder
```

Disables autofill for the app or activity.

This method is useful to optimize performance in cases where the service knows it can not autofill an app---for example, when the service has a list of "denylisted" apps such as office suites.

By default, it disables autofill for all activities in the app, unless the response is `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#setFlags(kotlin.Int)` with `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse#FLAG_DISABLE_ACTIVITY_ONLY:kotlin.Int`.

Autofill for the app or activity is automatically re-enabled after any of the following conditions:

1. `duration` milliseconds have passed.
2. The autofill service for the user has changed.
3. The device has rebooted.

**Note:** Activities that are running when autofill is re-enabled remain disabled for autofill until they finish and restart.

| Parameters ||
|---|---|
| `duration` | [Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html): duration to disable autofill, in milliseconds. |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#` | this builder. This value cannot be `null`. |

| Exceptions ||
|---|---|
| `java.lang.IllegalArgumentException` | if `duration` is not a positive number. |
| `java.lang.IllegalStateException` | if either `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#addDataset(android.service.autofill.Dataset)`, `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#setAuthentication(kotlin.Array,%20android.content.IntentSender,%20android.service.autofill.Presentations)`, `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#setSaveInfo(android.service.autofill.SaveInfo)`, `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#setClientState(android.os.Bundle)`, or `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#setFieldClassificationIds(android.view.autofill.AutofillId)` was already called. |

### setAuthentication

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

```
fun setAuthentication(
    ids: Array<AutofillId!>, 
    authentication: IntentSender?, 
    presentations: Presentations?
): FillResponse.Builder
```

Triggers a custom UI before autofilling the screen with any data set in this response.

**Note:** Although the name of this method suggests that it should be used just for authentication flow, it can be used for other advanced flows; see `https://developer.android.com/reference/kotlin/android/service/autofill/AutofillService` for examples.

This is typically useful when a user interaction is required to unlock their data vault if you encrypt the data set labels and data set data. It is recommended to encrypt only the sensitive data and not the data set labels which would allow auth on the data set level leading to a better user experience. Note that if you use sensitive data as a label, for example an email address, then it should also be encrypted. The provided `https://developer.android.com/reference/kotlin/android/app/PendingIntent.html#` must be an `https://developer.android.com/reference/kotlin/android/app/Activity.html#` which implements your authentication flow. Also if you provide an auth intent you also need to specify the presentation view to be shown in the fill UI for the user to trigger your authentication flow.

When a user triggers autofill, the system launches the provided intent whose extras will have the `https://developer.android.com/reference/kotlin/android/view/autofill/AutofillManager.html#EXTRA_ASSIST_STRUCTURE:kotlin.String` and your `https://developer.android.com/reference/kotlin/android/view/autofill/AutofillManager.html#EXTRA_CLIENT_STATE:kotlin.String`. Once you complete your authentication flow you should set the `https://developer.android.com/reference/kotlin/android/app/Activity.html#` result to `https://developer.android.com/reference/kotlin/android/app/Activity.html#RESULT_OK:kotlin.Int` and set the `https://developer.android.com/reference/kotlin/android/view/autofill/AutofillManager.html#EXTRA_AUTHENTICATION_RESULT:kotlin.String` extra with the fully populated `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse` (or `null` if the screen cannot be autofilled).

For example, if you provided an empty `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse` because the user's data was locked and marked that the response needs an authentication then in the response returned if authentication succeeds you need to provide all available data sets some of which may need to be further authenticated, for example a credit card whose CVV needs to be entered.

If you provide an authentication intent you must also provide a presentation which is used to visualize the response for triggering the authentication flow.

**Note:** Do not make the provided pending intent immutable by using `https://developer.android.com/reference/kotlin/android/app/PendingIntent.html#FLAG_IMMUTABLE:kotlin.Int` as the platform needs to fill in the authentication arguments.

**Note:** `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#setHeader(android.widget.RemoteViews)` or `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#setFooter(android.widget.RemoteViews)` does not work with `https://developer.android.com/reference/kotlin/android/service/autofill/InlinePresentation`.

| Parameters ||
|---|---|
| `ids` | [Array](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html)\<[AutofillId](https://developer.android.com/reference/kotlin/android/view/autofill/AutofillId.html#)!\>: id of Views that when focused will display the authentication UI. This value cannot be `null`. |
| `authentication` | [IntentSender](https://developer.android.com/reference/kotlin/android/content/IntentSender.html#)?: Intent to an activity with your authentication flow. This value may be `null`. |
| `presentations` | [Presentations](https://developer.android.com/reference/kotlin/android/service/autofill/Presentations)?: The presentations to visualize the response. This value may be `null`. |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#` | This builder. |

| Exceptions ||
|---|---|
| `java.lang.IllegalArgumentException` | if any of the following occurs: - `ids` is `null` - `ids` is empty - `ids` contains a `null` element - `authentication` is `null`, but either or both of `presentations.getPresentation()` and `presentations.getInlinePresentation()` is non-`null` - `authentication` is non-{`null`, but both `presentations.getPresentation()` and `presentations.getInlinePresentation()` are `null` |
| `java.lang.IllegalStateException` | if a `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#setHeader(android.widget.RemoteViews)` or a `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#setFooter(android.widget.RemoteViews)` are already set for this builder. |

### setAuthentication

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

```
fun setAuthentication(
    ids: Array<AutofillId!>, 
    authentication: IntentSender?, 
    presentation: RemoteViews?
): FillResponse.Builder
```

**Deprecated:** *Use `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#setAuthentication(kotlin.Array,%20android.content.IntentSender,%20android.service.autofill.Presentations)` instead.*

Triggers a custom UI before autofilling the screen with any data set in this response.

**Note:** Although the name of this method suggests that it should be used just for authentication flow, it can be used for other advanced flows; see `https://developer.android.com/reference/kotlin/android/service/autofill/AutofillService` for examples.

This is typically useful when a user interaction is required to unlock their data vault if you encrypt the data set labels and data set data. It is recommended to encrypt only the sensitive data and not the data set labels which would allow auth on the data set level leading to a better user experience. Note that if you use sensitive data as a label, for example an email address, then it should also be encrypted. The provided `https://developer.android.com/reference/kotlin/android/app/PendingIntent.html#` must be an `https://developer.android.com/reference/kotlin/android/app/Activity.html#` which implements your authentication flow. Also if you provide an auth intent you also need to specify the presentation view to be shown in the fill UI for the user to trigger your authentication flow.

When a user triggers autofill, the system launches the provided intent whose extras will have the `https://developer.android.com/reference/kotlin/android/view/autofill/AutofillManager.html#EXTRA_ASSIST_STRUCTURE:kotlin.String` and your `https://developer.android.com/reference/kotlin/android/view/autofill/AutofillManager.html#EXTRA_CLIENT_STATE:kotlin.String`. Once you complete your authentication flow you should set the `https://developer.android.com/reference/kotlin/android/app/Activity.html#` result to `https://developer.android.com/reference/kotlin/android/app/Activity.html#RESULT_OK:kotlin.Int` and set the `https://developer.android.com/reference/kotlin/android/view/autofill/AutofillManager.html#EXTRA_AUTHENTICATION_RESULT:kotlin.String` extra with the fully populated `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse` (or `null` if the screen cannot be autofilled).

**IMPORTANT** : Extras must be non-null on the intent being set for Android 12 otherwise it will cause a crash. Do not use `https://developer.android.com/reference/kotlin/android/app/Activity.html#setResult(kotlin.Int)`, instead use `https://developer.android.com/reference/kotlin/android/app/Activity.html#setResult(kotlin.Int,%20android.content.Intent)` with non-null extras. Consider setting `https://developer.android.com/reference/kotlin/android/view/autofill/AutofillManager.html#EXTRA_AUTHENTICATION_RESULT:kotlin.String` to null or use `https://developer.android.com/reference/kotlin/android/os/Bundle.html#EMPTY:android.os.Bundle` with `https://developer.android.com/reference/kotlin/android/content/Intent.html#putExtras(android.os.Bundle)` on the intent when finishing activity to avoid crash).

For example, if you provided an empty `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse` because the user's data was locked and marked that the response needs an authentication then in the response returned if authentication succeeds you need to provide all available data sets some of which may need to be further authenticated, for example a credit card whose CVV needs to be entered.

If you provide an authentication intent you must also provide a presentation which is used to visualize the response for triggering the authentication flow.

**Note:** Do not make the provided pending intent immutable by using `https://developer.android.com/reference/kotlin/android/app/PendingIntent.html#FLAG_IMMUTABLE:kotlin.Int` as the platform needs to fill in the authentication arguments.

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

| Parameters ||
|---|---|
| `ids` | [Array](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html)\<[AutofillId](https://developer.android.com/reference/kotlin/android/view/autofill/AutofillId.html#)!\>: id of Views that when focused will display the authentication UI. This value cannot be `null`. |
| `authentication` | [IntentSender](https://developer.android.com/reference/kotlin/android/content/IntentSender.html#)?: Intent to an activity with your authentication flow. This value may be `null`. |
| `presentation` | [RemoteViews](https://developer.android.com/reference/kotlin/android/widget/RemoteViews.html#)?: The presentation to visualize the response. This value may be `null`. |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#` | This builder. |

| Exceptions ||
|---|---|
| `java.lang.IllegalArgumentException` | if any of the following occurs: - `ids` is `null` - `ids` is empty - `ids` contains a `null` element - both `authentication` and `presentation` are `null` - both `authentication` and `presentation` are non-`null` |
| `java.lang.IllegalStateException` | if a `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#setHeader(android.widget.RemoteViews)` or a `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#setFooter(android.widget.RemoteViews)` are already set for this builder. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/PendingIntent.html#getIntentSender()`

### setAuthentication

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

```
fun setAuthentication(
    ids: Array<AutofillId!>, 
    authentication: IntentSender?, 
    presentation: RemoteViews?, 
    inlinePresentation: InlinePresentation?
): FillResponse.Builder
```

**Deprecated:** *Use `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#setAuthentication(kotlin.Array,%20android.content.IntentSender,%20android.service.autofill.Presentations)` instead.*

Triggers a custom UI before autofilling the screen with any data set in this response.

**Note:** Although the name of this method suggests that it should be used just for authentication flow, it can be used for other advanced flows; see `https://developer.android.com/reference/kotlin/android/service/autofill/AutofillService` for examples.

This method is similar to `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#setAuthentication(kotlin.Array,%20android.content.IntentSender,%20android.widget.RemoteViews)`, but also accepts an `https://developer.android.com/reference/kotlin/android/service/autofill/InlinePresentation` presentation which is required for authenticating through the inline autofill flow.

**Note:** `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#setHeader(android.widget.RemoteViews)` or `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#setFooter(android.widget.RemoteViews)` does not work with `https://developer.android.com/reference/kotlin/android/service/autofill/InlinePresentation`.

| Parameters ||
|---|---|
| `ids` | [Array](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html)\<[AutofillId](https://developer.android.com/reference/kotlin/android/view/autofill/AutofillId.html#)!\>: id of Views that when focused will display the authentication UI. This value cannot be `null`. |
| `authentication` | [IntentSender](https://developer.android.com/reference/kotlin/android/content/IntentSender.html#)?: Intent to an activity with your authentication flow. This value may be `null`. |
| `presentation` | [RemoteViews](https://developer.android.com/reference/kotlin/android/widget/RemoteViews.html#)?: The presentation to visualize the response. This value may be `null`. |
| `inlinePresentation` | [InlinePresentation](https://developer.android.com/reference/kotlin/android/service/autofill/InlinePresentation)?: The inlinePresentation to visualize the response inline. This value may be `null`. |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#` | This builder. This value cannot be `null`. |

| Exceptions ||
|---|---|
| `java.lang.IllegalArgumentException` | if any of the following occurs: - `ids` is `null` - `ids` is empty - `ids` contains a `null` element - both `authentication` and `presentation` are `null` - both `authentication` and `presentation` are non-`null` - both `authentication` and `inlinePresentation` are `null` - both `authentication` and `inlinePresentation` are non-`null` |
| `java.lang.IllegalStateException` | if a `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#setHeader(android.widget.RemoteViews)` or a `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#setFooter(android.widget.RemoteViews)` are already set for this builder. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/PendingIntent.html#getIntentSender()`

### setAuthentication

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

```
fun setAuthentication(
    ids: Array<AutofillId!>, 
    authentication: IntentSender?, 
    presentation: RemoteViews?, 
    inlinePresentation: InlinePresentation?, 
    inlineTooltipPresentation: InlinePresentation?
): FillResponse.Builder
```

**Deprecated:** *Use `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#setAuthentication(kotlin.Array,%20android.content.IntentSender,%20android.service.autofill.Presentations)` instead.*

Triggers a custom UI before autofilling the screen with any data set in this response.

This method like `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#setAuthentication(kotlin.Array,%20android.content.IntentSender,%20android.widget.RemoteViews,%20android.service.autofill.InlinePresentation)` but allows setting an `https://developer.android.com/reference/kotlin/android/service/autofill/InlinePresentation` for the inline suggestion tooltip.

| Parameters ||
|---|---|
| `ids` | [Array](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html)\<[AutofillId](https://developer.android.com/reference/kotlin/android/view/autofill/AutofillId.html#)!\>: This value cannot be `null`. |
| `authentication` | [IntentSender](https://developer.android.com/reference/kotlin/android/content/IntentSender.html#)?: This value may be `null`. |
| `presentation` | [RemoteViews](https://developer.android.com/reference/kotlin/android/widget/RemoteViews.html#)?: This value may be `null`. |
| `inlinePresentation` | [InlinePresentation](https://developer.android.com/reference/kotlin/android/service/autofill/InlinePresentation)?: This value may be `null`. |
| `inlineTooltipPresentation` | [InlinePresentation](https://developer.android.com/reference/kotlin/android/service/autofill/InlinePresentation)?: This value may be `null`. |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#` | This value cannot be `null`. |

### setClientState

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

```
fun setClientState(clientState: Bundle?): FillResponse.Builder
```

Sets a bundle with state that is passed to subsequent APIs that manipulate this response.

You can use this bundle to store intermediate state that is passed to subsequent calls to `https://developer.android.com/reference/kotlin/android/service/autofill/AutofillService#onFillRequest(android.service.autofill.FillRequest,%20android.os.CancellationSignal,%20android.service.autofill.FillCallback)` and `https://developer.android.com/reference/kotlin/android/service/autofill/AutofillService#onSaveRequest(android.service.autofill.SaveRequest,%20android.service.autofill.SaveCallback)`, and you can also retrieve it by calling `https://developer.android.com/reference/kotlin/android/service/autofill/FillEventHistory.Event#getClientState()`.

If this method is called on multiple `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse` objects for the same screen, just the latest bundle is passed back to the service.

| Parameters ||
|---|---|
| `clientState` | [Bundle](https://developer.android.com/reference/kotlin/android/os/Bundle.html#)?: The custom client state. This value may be `null`. |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#` | This builder. This value cannot be `null`. |

### setDetectedFieldClassifications

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

```
fun setDetectedFieldClassifications(fieldInfos: MutableSet<FieldClassification!>): FillResponse.Builder
```

Adds a new `https://developer.android.com/reference/kotlin/android/service/assist/classification/FieldClassification.html#` to this response, to help the platform provide more accurate detection results. Call this when a field has been detected with a type. Altough similiarly named with `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#setFieldClassificationIds(android.view.autofill.AutofillId)`, it provides a different functionality - setFieldClassificationIds should be used when a field is only suspected to be Autofillable. This method should be used when a field is certainly Autofillable with a certain type.

| Parameters ||
|---|---|
| `fieldInfos` | [MutableSet](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-set/index.html)\<[FieldClassification](https://developer.android.com/reference/kotlin/android/service/assist/classification/FieldClassification.html#)!\>: This value cannot be `null`. |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#` | This value cannot be `null`. |

### setDialogHeader

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

```
fun setDialogHeader(header: RemoteViews): FillResponse.Builder
```

Sets the presentation of header in fill dialog UI. The header should have a prompt for what datasets are shown in the dialog. If this is not set, the dialog only shows your application icon. More details about the fill dialog, see [fill dialog UI](https://developer.android.com/reference/kotlin/android/service/autofill/Dataset#FillDialogUI)

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

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#` | This value cannot be `null`. |

### setFieldClassificationIds

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

```
fun setFieldClassificationIds(vararg ids: AutofillId!): FillResponse.Builder
```

Sets which fields are used for [field classification](https://developer.android.com/reference/kotlin/android/service/autofill/AutofillService#FieldClassification)

**Note:** This method automatically adds the `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse#FLAG_TRACK_CONTEXT_COMMITED:kotlin.Int` to the `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#setFlags(kotlin.Int)`.

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

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#` | This value cannot be `null`. |

| Exceptions ||
|---|---|
| `java.lang.IllegalArgumentException` | is length of `ids` args is more than `https://developer.android.com/reference/kotlin/android/service/autofill/UserData#getMaxFieldClassificationIdsSize()`. |
| `java.lang.IllegalStateException` | if `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#build()` or `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#disableAutofill(kotlin.Long)` was already called. |
| `java.lang.NullPointerException` | if `ids` or any element on it is `null`. |

### setFillDialogTriggerIds

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

```
fun setFillDialogTriggerIds(vararg ids: AutofillId!): FillResponse.Builder
```

Sets which fields are used for the fill dialog UI. More details about the fill dialog, see [fill dialog UI](https://developer.android.com/reference/kotlin/android/service/autofill/Dataset#FillDialogUI)

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

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#` | This value cannot be `null`. |

| Exceptions ||
|---|---|
| `java.lang.IllegalStateException` | if `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#build()` was already called. |
| `java.lang.NullPointerException` | if `ids` or any element on it is `null`. |

### setFlags

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

```
fun setFlags(flags: Int): FillResponse.Builder
```

Sets flags changing the response behavior.

| Parameters ||
|---|---|
| `flags` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): a combination of `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse#FLAG_TRACK_CONTEXT_COMMITED:kotlin.Int` and `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse#FLAG_DISABLE_ACTIVITY_ONLY:kotlin.Int`, or `0`. Value is either `0` or a combination of the following: - `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse#FLAG_TRACK_CONTEXT_COMMITED:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse#FLAG_DISABLE_ACTIVITY_ONLY:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse#FLAG_DELAY_FILL:kotlin.Int` |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#` | This builder. This value cannot be `null`. |

### setFooter

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

```
fun setFooter(footer: RemoteViews): FillResponse.Builder
```

Sets a footer to be shown as the last element in the list of datasets.

When this method is called, you must also `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#addDataset(android.service.autofill.Dataset)`, otherwise `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#build()` throws an `https://developer.android.com/reference/kotlin/java/lang/IllegalStateException.html#`. Similarly, this method should only be used on `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse` that do not require authentication (as the footer could have been set directly in the main presentation in these cases).

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

| Parameters ||
|---|---|
| `footer` | [RemoteViews](https://developer.android.com/reference/kotlin/android/widget/RemoteViews.html#): a presentation to represent the footer. This presentation is not clickable ---calling `https://developer.android.com/reference/kotlin/android/widget/RemoteViews.html#setOnClickPendingIntent(kotlin.Int,%20android.app.PendingIntent)` on it would have no effect. This value cannot be `null`. |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#` | this builder. This value cannot be `null`. |

| Exceptions ||
|---|---|
| `java.lang.IllegalStateException` | if the FillResponse `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#setAuthentication(kotlin.Array,%20android.content.IntentSender,%20android.service.autofill.Presentations)`. |

### setHeader

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

```
fun setHeader(header: RemoteViews): FillResponse.Builder
```

Sets a header to be shown as the first element in the list of datasets.

When this method is called, you must also `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#addDataset(android.service.autofill.Dataset)`, otherwise `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#build()` throws an `https://developer.android.com/reference/kotlin/java/lang/IllegalStateException.html#`. Similarly, this method should only be used on `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse` that do not require authentication (as the header could have been set directly in the main presentation in these cases).

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

| Parameters ||
|---|---|
| `header` | [RemoteViews](https://developer.android.com/reference/kotlin/android/widget/RemoteViews.html#): a presentation to represent the header. This presentation is not clickable ---calling `https://developer.android.com/reference/kotlin/android/widget/RemoteViews.html#setOnClickPendingIntent(kotlin.Int,%20android.app.PendingIntent)` on it would have no effect. This value cannot be `null`. |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#` | this builder. This value cannot be `null`. |

| Exceptions ||
|---|---|
| `java.lang.IllegalStateException` | if an `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#setAuthentication(kotlin.Array,%20android.content.IntentSender,%20android.service.autofill.Presentations)` was already set for this builder. |

### setIconResourceId

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

```
fun setIconResourceId(id: Int): FillResponse.Builder
```

Overwrites Save/Fill dialog header icon with a specific one specified by resource id. The image is pulled from the package, so id should be defined in the manifest.

| Parameters ||
|---|---|
| `id` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): `https://developer.android.com/reference/kotlin/android/graphics/drawable/Drawable.html#` resource id of the icon to be used. A value of 0 indicates to use the default header icon. |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#` | this builder. This value cannot be `null`. |

### setIgnoredIds

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

```
fun setIgnoredIds(vararg ids: AutofillId!): FillResponse.Builder
```

Specifies views that should not trigger new `https://developer.android.com/reference/kotlin/android/service/autofill/AutofillService#onFillRequest(android.service.autofill.FillRequest,%20android.os.CancellationSignal,%20android.service.autofill.FillCallback)` requests.

This is typically used when the service cannot autofill the view; for example, a text field representing the result of a Captcha challenge.

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#` | This value cannot be `null`. |

### setPresentationCancelIds

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

```
fun setPresentationCancelIds(ids: IntArray?): FillResponse.Builder
```

Sets target resource IDs of the child view in `https://developer.android.com/reference/kotlin/android/widget/RemoteViews.html#` which will cancel the session when clicked. Those targets will be respectively applied to a child of the header, footer and each `https://developer.android.com/reference/kotlin/android/service/autofill/Dataset`.

| Parameters ||
|---|---|
| `ids` | [IntArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int-array/index.html)?: array of the resource id. Empty list or non-existing id has no effect. This value may be `null`. |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#` | this builder. This value cannot be `null`. |

| Exceptions ||
|---|---|
| `java.lang.IllegalStateException` | if `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#build()` was already called. |

### setSaveInfo

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

```
fun setSaveInfo(saveInfo: SaveInfo): FillResponse.Builder
```

Sets the `https://developer.android.com/reference/kotlin/android/service/autofill/SaveInfo` associated with this response.

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

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#` | This builder. This value cannot be `null`. |

### setServiceDisplayNameResourceId

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

```
fun setServiceDisplayNameResourceId(id: Int): FillResponse.Builder
```

Overrides the service name in the Save Dialog header with a specific string defined in the service provider's manifest.xml

| Parameters ||
|---|---|
| `id` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): Resoure Id of the custom string defined in the provider's manifest. If set to 0, the default name will be used. |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#` | this builder. This value cannot be `null`. |

### setShowFillDialogIcon

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

```
fun setShowFillDialogIcon(show: Boolean): FillResponse.Builder
```

Whether or not to show the Autofill provider icon inside of the Fill Dialog

| Parameters ||
|---|---|
| `show` | [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html): True to show, false to hide. Defaults to true. |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#` | this builder. This value cannot be `null`. |

### setShowSaveDialogIcon

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

```
fun setShowSaveDialogIcon(show: Boolean): FillResponse.Builder
```

Whether or not to show the Autofill provider icon inside of the Save Dialog

| Parameters ||
|---|---|
| `show` | [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html): True to show, false to hide. Defaults to true. |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#` | this builder. This value cannot be `null`. |

### setUserData

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

```
fun setUserData(userData: UserData): FillResponse.Builder
```

Sets a specific `https://developer.android.com/reference/kotlin/android/service/autofill/UserData` for field classification for this request only.

Any fields in this UserData will override corresponding fields in the generic UserData object

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

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#` | this builder. This value cannot be `null`. |

| Exceptions ||
|---|---|
| `java.lang.IllegalStateException` | if the FillResponse `https://developer.android.com/reference/kotlin/android/service/autofill/FillResponse.Builder#setAuthentication(kotlin.Array,%20android.content.IntentSender,%20android.service.autofill.Presentations)`. |