Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Ctors](https://developer.android.com/reference/android/service/autofill/Dataset.Builder#pubctors) \| [Methods](https://developer.android.com/reference/android/service/autofill/Dataset.Builder#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/service/autofill/Dataset.Builder#inhmethods)

# Dataset.Builder

*** ** * ** ***


`
public
static
final

class
Dataset.Builder
`


`

extends https://developer.android.com/reference/java/lang/Object


`

`


`

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.service.autofill.Dataset.Builder |

<br />

*** ** * ** ***

A builder for `https://developer.android.com/reference/android/service/autofill/Dataset` objects. You must provide at least
one value for a field or set an authentication intent.

## Summary

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/service/autofill/Dataset.Builder#Builder()() ` Creates a new builder for a dataset where each field will be visualized independently. |
| ` https://developer.android.com/reference/android/service/autofill/Dataset.Builder#Builder(android.service.autofill.Presentations)(https://developer.android.com/reference/android/service/autofill/Presentations presentations) ` Creates a new builder. |
| ` https://developer.android.com/reference/android/service/autofill/Dataset.Builder#Builder(android.widget.RemoteViews)(https://developer.android.com/reference/android/widget/RemoteViews presentation) ` *This constructor is deprecated. Use `https://developer.android.com/reference/android/service/autofill/Dataset.Builder#Builder(android.service.autofill.Presentations)` instead.* |

| ### Public methods ||
|---|---|
| ` https://developer.android.com/reference/android/service/autofill/Dataset` | ` https://developer.android.com/reference/android/service/autofill/Dataset.Builder#build()() ` Creates a new `https://developer.android.com/reference/android/service/autofill/Dataset` instance. |
| ` https://developer.android.com/reference/android/service/autofill/Dataset.Builder` | ` https://developer.android.com/reference/android/service/autofill/Dataset.Builder#setAuthentication(android.content.IntentSender)(https://developer.android.com/reference/android/content/IntentSender authentication) ` Triggers a custom UI before before autofilling the screen with the contents of this dataset. |
| ` https://developer.android.com/reference/android/service/autofill/Dataset.Builder` | ` https://developer.android.com/reference/android/service/autofill/Dataset.Builder#setField(android.view.autofill.AutofillId,%20android.service.autofill.Field)(https://developer.android.com/reference/android/view/autofill/AutofillId id, https://developer.android.com/reference/android/service/autofill/Field field) ` Sets the value of a field. |
| ` https://developer.android.com/reference/android/service/autofill/Dataset.Builder` | ` https://developer.android.com/reference/android/service/autofill/Dataset.Builder#setField(java.lang.String,%20android.service.autofill.Field)(https://developer.android.com/reference/java/lang/String hint, https://developer.android.com/reference/android/service/autofill/Field field) ` Adds a field to this Dataset with a specific type. |
| ` https://developer.android.com/reference/android/service/autofill/Dataset.Builder` | ` https://developer.android.com/reference/android/service/autofill/Dataset.Builder#setFieldForAllHints(android.service.autofill.Field)(https://developer.android.com/reference/android/service/autofill/Field field) ` Adds a field to this Dataset that is relevant to all applicable hints. |
| ` https://developer.android.com/reference/android/service/autofill/Dataset.Builder` | ` https://developer.android.com/reference/android/service/autofill/Dataset.Builder#setId(java.lang.String)(https://developer.android.com/reference/java/lang/String id) ` Sets the id for the dataset so its usage can be tracked. |
| ` https://developer.android.com/reference/android/service/autofill/Dataset.Builder` | ` https://developer.android.com/reference/android/service/autofill/Dataset.Builder#setInlinePresentation(android.service.autofill.InlinePresentation,%20android.service.autofill.InlinePresentation)(https://developer.android.com/reference/android/service/autofill/InlinePresentation inlinePresentation, https://developer.android.com/reference/android/service/autofill/InlinePresentation inlineTooltipPresentation) ` *This method was deprecated in API level 33. Use `https://developer.android.com/reference/android/service/autofill/Dataset.Builder#Builder(android.service.autofill.Presentations)` instead.* |
| ` https://developer.android.com/reference/android/service/autofill/Dataset.Builder` | ` https://developer.android.com/reference/android/service/autofill/Dataset.Builder#setInlinePresentation(android.service.autofill.InlinePresentation)(https://developer.android.com/reference/android/service/autofill/InlinePresentation inlinePresentation) ` *This method was deprecated in API level 33. Use `https://developer.android.com/reference/android/service/autofill/Dataset.Builder#Builder(android.service.autofill.Presentations)` instead.* |
| ` https://developer.android.com/reference/android/service/autofill/Dataset.Builder` | ` https://developer.android.com/reference/android/service/autofill/Dataset.Builder#setValue(android.view.autofill.AutofillId,%20android.view.autofill.AutofillValue,%20java.util.regex.Pattern)(https://developer.android.com/reference/android/view/autofill/AutofillId id, https://developer.android.com/reference/android/view/autofill/AutofillValue value, https://developer.android.com/reference/java/util/regex/Pattern filter) ` *This method was deprecated in API level 33. Use `https://developer.android.com/reference/android/service/autofill/Dataset.Builder#setField(android.view.autofill.AutofillId,%20android.service.autofill.Field)` instead.* |
| ` https://developer.android.com/reference/android/service/autofill/Dataset.Builder` | ` https://developer.android.com/reference/android/service/autofill/Dataset.Builder#setValue(android.view.autofill.AutofillId,%20android.view.autofill.AutofillValue,%20java.util.regex.Pattern,%20android.widget.RemoteViews,%20android.service.autofill.InlinePresentation)(https://developer.android.com/reference/android/view/autofill/AutofillId id, https://developer.android.com/reference/android/view/autofill/AutofillValue value, https://developer.android.com/reference/java/util/regex/Pattern filter, https://developer.android.com/reference/android/widget/RemoteViews presentation, https://developer.android.com/reference/android/service/autofill/InlinePresentation inlinePresentation) ` *This method was deprecated in API level 33. Use `https://developer.android.com/reference/android/service/autofill/Dataset.Builder#setField(android.view.autofill.AutofillId,%20android.service.autofill.Field)` instead.* |
| ` https://developer.android.com/reference/android/service/autofill/Dataset.Builder` | ` https://developer.android.com/reference/android/service/autofill/Dataset.Builder#setValue(android.view.autofill.AutofillId,%20android.view.autofill.AutofillValue,%20android.widget.RemoteViews)(https://developer.android.com/reference/android/view/autofill/AutofillId id, https://developer.android.com/reference/android/view/autofill/AutofillValue value, https://developer.android.com/reference/android/widget/RemoteViews presentation) ` *This method was deprecated in API level 33. Use `https://developer.android.com/reference/android/service/autofill/Dataset.Builder#setField(android.view.autofill.AutofillId,%20android.service.autofill.Field)` instead.* |
| ` https://developer.android.com/reference/android/service/autofill/Dataset.Builder` | ` https://developer.android.com/reference/android/service/autofill/Dataset.Builder#setValue(android.view.autofill.AutofillId,%20android.view.autofill.AutofillValue)(https://developer.android.com/reference/android/view/autofill/AutofillId id, https://developer.android.com/reference/android/view/autofill/AutofillValue value) ` *This method was deprecated in API level 33. Use `https://developer.android.com/reference/android/service/autofill/Dataset.Builder#setField(android.view.autofill.AutofillId,%20android.service.autofill.Field)` instead.* |
| ` https://developer.android.com/reference/android/service/autofill/Dataset.Builder` | ` https://developer.android.com/reference/android/service/autofill/Dataset.Builder#setValue(android.view.autofill.AutofillId,%20android.view.autofill.AutofillValue,%20java.util.regex.Pattern,%20android.widget.RemoteViews,%20android.service.autofill.InlinePresentation,%20android.service.autofill.InlinePresentation)(https://developer.android.com/reference/android/view/autofill/AutofillId id, https://developer.android.com/reference/android/view/autofill/AutofillValue value, https://developer.android.com/reference/java/util/regex/Pattern filter, https://developer.android.com/reference/android/widget/RemoteViews presentation, https://developer.android.com/reference/android/service/autofill/InlinePresentation inlinePresentation, https://developer.android.com/reference/android/service/autofill/InlinePresentation inlineTooltipPresentation) ` *This method was deprecated in API level 33. Use `https://developer.android.com/reference/android/service/autofill/Dataset.Builder#setField(android.view.autofill.AutofillId,%20android.service.autofill.Field)` instead.* |
| ` https://developer.android.com/reference/android/service/autofill/Dataset.Builder` | ` https://developer.android.com/reference/android/service/autofill/Dataset.Builder#setValue(android.view.autofill.AutofillId,%20android.view.autofill.AutofillValue,%20android.widget.RemoteViews,%20android.service.autofill.InlinePresentation)(https://developer.android.com/reference/android/view/autofill/AutofillId id, https://developer.android.com/reference/android/view/autofill/AutofillValue value, https://developer.android.com/reference/android/widget/RemoteViews presentation, https://developer.android.com/reference/android/service/autofill/InlinePresentation inlinePresentation) ` *This method was deprecated in API level 33. Use `https://developer.android.com/reference/android/service/autofill/Dataset.Builder#setField(android.view.autofill.AutofillId,%20android.service.autofill.Field)` instead.* |
| ` https://developer.android.com/reference/android/service/autofill/Dataset.Builder` | ` https://developer.android.com/reference/android/service/autofill/Dataset.Builder#setValue(android.view.autofill.AutofillId,%20android.view.autofill.AutofillValue,%20android.widget.RemoteViews,%20android.service.autofill.InlinePresentation,%20android.service.autofill.InlinePresentation)(https://developer.android.com/reference/android/view/autofill/AutofillId id, https://developer.android.com/reference/android/view/autofill/AutofillValue value, https://developer.android.com/reference/android/widget/RemoteViews presentation, https://developer.android.com/reference/android/service/autofill/InlinePresentation inlinePresentation, https://developer.android.com/reference/android/service/autofill/InlinePresentation inlineTooltipPresentation) ` *This method was deprecated in API level 33. Use `https://developer.android.com/reference/android/service/autofill/Dataset.Builder#setField(android.view.autofill.AutofillId,%20android.service.autofill.Field)` instead.* |
| ` https://developer.android.com/reference/android/service/autofill/Dataset.Builder` | ` https://developer.android.com/reference/android/service/autofill/Dataset.Builder#setValue(android.view.autofill.AutofillId,%20android.view.autofill.AutofillValue,%20java.util.regex.Pattern,%20android.widget.RemoteViews)(https://developer.android.com/reference/android/view/autofill/AutofillId id, https://developer.android.com/reference/android/view/autofill/AutofillValue value, https://developer.android.com/reference/java/util/regex/Pattern filter, https://developer.android.com/reference/android/widget/RemoteViews presentation) ` *This method was deprecated in API level 33. Use `https://developer.android.com/reference/android/service/autofill/Dataset.Builder#setField(android.view.autofill.AutofillId,%20android.service.autofill.Field)` instead.* |

| ### Inherited methods |
|---|---|
| From class ` https://developer.android.com/reference/java/lang/Object ` |---|---| | ` https://developer.android.com/reference/java/lang/Object` | ` https://developer.android.com/reference/java/lang/Object#clone()() ` Creates and returns a copy of this object. | | ` boolean` | ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) ` Indicates whether some other object is "equal to" this one. | | ` void` | ` https://developer.android.com/reference/java/lang/Object#finalize()() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. | | ` final https://developer.android.com/reference/java/lang/Class<?>` | ` https://developer.android.com/reference/java/lang/Object#getClass()() ` Returns the runtime class of this `Object`. | | ` int` | ` https://developer.android.com/reference/java/lang/Object#hashCode()() ` Returns a hash code value for the object. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#notify()() ` Wakes up a single thread that is waiting on this object's monitor. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#notifyAll()() ` Wakes up all threads that are waiting on this object's monitor. | | ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/java/lang/Object#toString()() ` Returns a string representation of the object. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos) ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis) ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait()() ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*. | ||

## Public constructors

### Builder

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

```
public Builder ()
```

Creates a new builder for a dataset where each field will be visualized independently.

When using this constructor, a presentation must be provided for each field through
`https://developer.android.com/reference/android/service/autofill/Dataset.Builder#setField(android.view.autofill.AutofillId,%20android.service.autofill.Field)`.

<br />

### Builder

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

```
public Builder (Presentations presentations)
```

Creates a new builder.

<br />

| Parameters ||
|---|---|
| `presentations` | `Presentations`: The presentations used to visualize this dataset. This value cannot be `null`. <br /> |

### Builder

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

```
public Builder (RemoteViews presentation)
```


**This constructor is deprecated.**   

Use `https://developer.android.com/reference/android/service/autofill/Dataset.Builder#Builder(android.service.autofill.Presentations)` instead.

Creates a new builder.

<br />

| Parameters ||
|---|---|
| `presentation` | `RemoteViews`: The presentation used to visualize this dataset. This value cannot be `null`. <br /> |

## Public methods

### build

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

```
public Dataset build ()
```

Creates a new `https://developer.android.com/reference/android/service/autofill/Dataset` instance.

You should not interact with this builder once this method is called.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/service/autofill/Dataset` | The built dataset. This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException` | if no field was set (through `https://developer.android.com/reference/android/service/autofill/Dataset.Builder#setField(android.view.autofill.AutofillId,%20android.service.autofill.Field)`), or if `https://developer.android.com/reference/android/service/autofill/Dataset.Builder#build()` was already called. |

### setAuthentication

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

```
public Dataset.Builder setAuthentication (IntentSender authentication)
```

Triggers a custom UI before before autofilling the screen with the contents of this
dataset.

**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/android/service/autofill/AutofillService`
for examples.

This method is called when you need to provide an authentication
UI for the data set. For example, when a data set contains credit card information
(such as number, expiration date, and verification code), you can display UI
asking for the verification code before filing in the data. Even if the
data set is completely populated the system will launch the specified authentication
intent and will need your approval to fill it in. Since the data set is "locked"
until the user authenticates it, typically this data set name is masked
(for example, "VISA....1234"). Typically you would want to store the data set
labels non-encrypted and the actual sensitive data encrypted and not in memory.
This allows showing the labels in the UI while involving the user if one of
the items with these labels is chosen. Note that if you use sensitive data as
a label, for example an email address, then it should also be encrypted.

When a user triggers autofill, the system launches the provided intent
whose extras will have the `https://developer.android.com/reference/android/view/autofill/AutofillManager#EXTRA_ASSIST_STRUCTURE`,
and your `https://developer.android.com/reference/android/view/autofill/AutofillManager#EXTRA_CLIENT_STATE`. Once you complete your authentication flow you should set the activity
result to `https://developer.android.com/reference/android/app/Activity#RESULT_OK` and provide the fully populated
`https://developer.android.com/reference/android/service/autofill/Dataset` or a fully-populated `https://developer.android.com/reference/android/service/autofill/FillResponse` by
setting it to the `https://developer.android.com/reference/android/view/autofill/AutofillManager#EXTRA_AUTHENTICATION_RESULT` extra. If you
provide a dataset in the result, it will replace the authenticated dataset and
will be immediately filled in. An exception to this behavior is if the original
dataset represents a pinned inline suggestion (i.e. any of the field in the dataset
has a pinned inline presentation, see `https://developer.android.com/reference/android/service/autofill/InlinePresentation#isPinned()`), then
the original dataset will not be replaced,
so that it can be triggered as a pending intent again.
If you provide a response, it will replace the
current response and the UI will be refreshed. For example, if you provided
credit card information without the CVV for the data set in the `https://developer.android.com/reference/android/service/autofill/FillResponse` then the returned data set should contain the CVV entry.

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

<br />

| Parameters ||
|---|---|
| `authentication` | `IntentSender`: Intent to an activity with your authentication flow. This value may be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/service/autofill/Dataset.Builder` | this builder. This value cannot be `null`. <br /> |

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

**See also:**

- `https://developer.android.com/reference/android/app/PendingIntent`

### setField

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

```
public Dataset.Builder setField (AutofillId id, 
                Field field)
```

Sets the value of a field.

Before Android 13, this information could be provided using several overloaded
setValue(...) methods. This method replaces those with a Builder pattern.
For example, in the old workflow, the app sets a field would be:

```
 Dataset.Builder dataset = new Dataset.Builder();
 if (filter != null) {
     if (presentation != null) {
         if (inlinePresentation != null) {
             dataset.setValue(id, value, filter, presentation, inlinePresentation)
         } else {
             dataset.setValue(id, value, filter, presentation);
         }
     } else {
         dataset.setValue(id, value, filter);
     }
 } else {
     if (presentation != null) {
         if (inlinePresentation != null) {
             dataset.setValue(id, value, presentation, inlinePresentation)
         } else {
             dataset.setValue(id, value, presentation);
         }
     } else {
         dataset.setValue(id, value);
     }
 }
 
```

The new workflow would be:

```
Field.Builder fieldBuilder = new Field.Builder();
if (value != null) {
    fieldBuilder.setValue(value);
}
if (filter != null) {
    fieldBuilder.setFilter(filter);
}
Presentations.Builder presentationsBuilder = new Presentations.Builder();
if (presentation != null) {
    presentationsBuilder.setMenuPresentation(presentation);
}
if (inlinePresentation != null) {
    presentationsBuilder.setInlinePresentation(inlinePresentation);
}
if (dialogPresentation != null) {
    presentationsBuilder.setDialogPresentation(dialogPresentation);
}
fieldBuilder.setPresentations(presentationsBuilder.build());
dataset.setField(id, fieldBuilder.build());
```

<br />

<br />

| Parameters ||
|---|---|
| `id` | `AutofillId`: id returned by `https://developer.android.com/reference/android/app/assist/AssistStructure.ViewNode#getAutofillId()`. This value cannot be `null`. <br /> |
| `field` | `Field`: the fill information about the field. This value may be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/service/autofill/Dataset.Builder` | this builder. <br /> |

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

**See also:**

- `https://developer.android.com/reference/android/service/autofill/Field`

### setField

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

```
public Dataset.Builder setField (String hint, 
                Field field)
```

Adds a field to this Dataset with a specific type. This is used to send back Field
information when Autofilling with platform detections is on.
Platform detections are on when receiving a populated list from
FillRequest#getHints().

Populate every field/type known for this user for this app.

For example, if getHints() contains "username" and "password",
a new Dataset should be created that calls this method twice,
one for the username, then another for the password (assuming
the only one credential pair is found for the user). If a user
has two credential pairs, then two Datasets should be created,
and so on.

<br />

| Parameters ||
|---|---|
| `hint` | `String`: An autofill hint returned from `https://developer.android.com/reference/android/service/autofill/FillRequest#getHints()`. This value cannot be `null`. <br /> |
| `field` | `Field`: the fill information about the field. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/service/autofill/Dataset.Builder` | this builder. This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException` | if `https://developer.android.com/reference/android/service/autofill/Dataset.Builder#build()` was already called or this builder also contains AutofillId information |

### setFieldForAllHints

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

```
public Dataset.Builder setFieldForAllHints (Field field)
```

Adds a field to this Dataset that is relevant to all applicable hints. This is used to
provide field information when autofill with platform detections is enabled.
Platform detections are on when receiving a populated list from
FillRequest#getHints().

<br />

| Parameters ||
|---|---|
| `field` | `Field`: the fill information about the field. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/service/autofill/Dataset.Builder` | this builder. This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException` | if `https://developer.android.com/reference/android/service/autofill/Dataset.Builder#build()` was already called or this builder also contains AutofillId information |

### setId

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

```
public Dataset.Builder setId (String id)
```

Sets the id for the dataset so its usage can be tracked.

Dataset usage can be tracked for 2 purposes:

- For statistical purposes, the service can call `https://developer.android.com/reference/android/service/autofill/AutofillService#getFillEventHistory()` when handling `https://developer.android.com/reference/android/service/autofill/AutofillService#onFillRequest(android.service.autofill.FillRequest,%20android.os.CancellationSignal,%20android.service.autofill.FillCallback)` calls.
- For normal autofill workflow, the service can call `https://developer.android.com/reference/android/service/autofill/SaveRequest#getDatasetIds()` when handling `https://developer.android.com/reference/android/service/autofill/AutofillService#onSaveRequest(android.service.autofill.SaveRequest,%20android.service.autofill.SaveCallback)` calls.

<br />

<br />

| Parameters ||
|---|---|
| `id` | `String`: id for this dataset or `null` to unset. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/service/autofill/Dataset.Builder` | this builder. This value cannot be `null`. <br /> |

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

### setInlinePresentation

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

```
public Dataset.Builder setInlinePresentation (InlinePresentation inlinePresentation, 
                InlinePresentation inlineTooltipPresentation)
```


**This method was deprecated
in API level 33.**   

Use `https://developer.android.com/reference/android/service/autofill/Dataset.Builder#Builder(android.service.autofill.Presentations)` instead.

Visualizes this dataset as inline suggestions.

<br />

| Parameters ||
|---|---|
| `inlinePresentation` | `InlinePresentation`: the `https://developer.android.com/reference/android/service/autofill/InlinePresentation` used to visualize this dataset as inline suggestions. If the dataset supports inline suggestions this should not be null. <br /> |
| `inlineTooltipPresentation` | `InlinePresentation`: the `https://developer.android.com/reference/android/service/autofill/InlinePresentation` used to show the tooltip for the `inlinePresentation`. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/service/autofill/Dataset.Builder` | this builder. This value cannot be `null`. <br /> |

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

### setInlinePresentation

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

```
public Dataset.Builder setInlinePresentation (InlinePresentation inlinePresentation)
```


**This method was deprecated
in API level 33.**   

Use `https://developer.android.com/reference/android/service/autofill/Dataset.Builder#Builder(android.service.autofill.Presentations)` instead.

Sets the `https://developer.android.com/reference/android/service/autofill/InlinePresentation` used to visualize this dataset as inline suggestions.
If the dataset supports inline suggestions this should not be null.

<br />

| Parameters ||
|---|---|
| `inlinePresentation` | `InlinePresentation`: This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/service/autofill/Dataset.Builder` | this builder. <br /> |

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

### setValue

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

```
public Dataset.Builder setValue (AutofillId id, 
                AutofillValue value, 
                Pattern filter)
```


**This method was deprecated
in API level 33.**   

Use `https://developer.android.com/reference/android/service/autofill/Dataset.Builder#setField(android.view.autofill.AutofillId,%20android.service.autofill.Field)` instead.

Sets the value of a field using an [explicit filter](https://developer.android.com/reference/android/service/autofill/Dataset.Builder#Filtering).

This method is typically used when the dataset requires authentication and the service
does not know its value but wants to hide the dataset after the user enters a minimum
number of characters. For example, if the dataset represents a credit card number and the
service does not want to show the "Tap to authenticate" message until the user tapped
4 digits, in which case the filter would be `Pattern.compile("\\d.{4,}")`.

**Note:** If the dataset requires authentication but the service knows its text
value it's easier to filter by calling `https://developer.android.com/reference/android/service/autofill/Dataset.Builder#setValue(android.view.autofill.AutofillId,%20android.view.autofill.AutofillValue)` and
use the value to filter.

<br />

| Parameters ||
|---|---|
| `id` | `AutofillId`: id returned by `https://developer.android.com/reference/android/app/assist/AssistStructure.ViewNode#getAutofillId()`. This value cannot be `null`. <br /> |
| `value` | `AutofillValue`: 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. <br /> |
| `filter` | `Pattern`: 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). <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/service/autofill/Dataset.Builder` | this builder. This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException` | if the builder was constructed without a `https://developer.android.com/reference/android/widget/RemoteViews` or `https://developer.android.com/reference/android/service/autofill/Dataset.Builder#build()` was already called. |

### setValue

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

```
public Dataset.Builder setValue (AutofillId id, 
                AutofillValue value, 
                Pattern filter, 
                RemoteViews presentation, 
                InlinePresentation inlinePresentation)
```


**This method was deprecated
in API level 33.**   

Use `https://developer.android.com/reference/android/service/autofill/Dataset.Builder#setField(android.view.autofill.AutofillId,%20android.service.autofill.Field)` instead.

Sets the value of a field, using a custom `https://developer.android.com/reference/android/widget/RemoteViews` to
visualize it and a [explicit filter](https://developer.android.com/reference/android/service/autofill/Dataset.Builder#Filtering), and an
`https://developer.android.com/reference/android/service/autofill/InlinePresentation` to visualize it as an inline suggestion.

This method is typically used when the dataset requires authentication and the service
does not know its value but wants to hide the dataset after the user enters a minimum
number of characters. For example, if the dataset represents a credit card number and the
service does not want to show the "Tap to authenticate" message until the user tapped
4 digits, in which case the filter would be `Pattern.compile("\\d.{4,}")`.

**Note:** If the dataset requires authentication but the service knows its text
value it's easier to filter by calling
`https://developer.android.com/reference/android/service/autofill/Dataset.Builder#setValue(android.view.autofill.AutofillId,%20android.view.autofill.AutofillValue,%20android.widget.RemoteViews)` and using the value to filter.

<br />

| Parameters ||
|---|---|
| `id` | `AutofillId`: id returned by `https://developer.android.com/reference/android/app/assist/AssistStructure.ViewNode#getAutofillId()`. This value cannot be `null`. <br /> |
| `value` | `AutofillValue`: 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. <br /> |
| `filter` | `Pattern`: 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). <br /> |
| `presentation` | `RemoteViews`: the presentation used to visualize this field. This value cannot be `null`. <br /> |
| `inlinePresentation` | `InlinePresentation`: The `https://developer.android.com/reference/android/service/autofill/InlinePresentation` used to visualize this dataset as inline suggestions. If the dataset supports inline suggestions, this should not be null. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/service/autofill/Dataset.Builder` | this builder. This value cannot be `null`. <br /> |

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

### setValue

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

```
public Dataset.Builder setValue (AutofillId id, 
                AutofillValue value, 
                RemoteViews presentation)
```


**This method was deprecated
in API level 33.**   

Use `https://developer.android.com/reference/android/service/autofill/Dataset.Builder#setField(android.view.autofill.AutofillId,%20android.service.autofill.Field)` instead.

Sets the value of a field, using a custom `https://developer.android.com/reference/android/widget/RemoteViews` to
visualize it.

**Note:** On Android `https://developer.android.com/reference/android/os/Build.VERSION_CODES#P` and
higher, datasets that require authentication can be also be filtered by passing a
`https://developer.android.com/reference/android/view/autofill/AutofillValue#forText(java.lang.CharSequence)` as the `value` parameter.

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

<br />

| Parameters ||
|---|---|
| `id` | `AutofillId`: id returned by `https://developer.android.com/reference/android/app/assist/AssistStructure.ViewNode#getAutofillId()`. This value cannot be `null`. <br /> |
| `value` | `AutofillValue`: 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. <br /> |
| `presentation` | `RemoteViews`: the presentation used to visualize this field. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/service/autofill/Dataset.Builder` | this builder. This value cannot be `null`. <br /> |

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

### setValue

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

```
public Dataset.Builder setValue (AutofillId id, 
                AutofillValue value)
```


**This method was deprecated
in API level 33.**   

Use `https://developer.android.com/reference/android/service/autofill/Dataset.Builder#setField(android.view.autofill.AutofillId,%20android.service.autofill.Field)` instead.

Sets the value of a field.

**Note:** Prior to Android `https://developer.android.com/reference/android/os/Build.VERSION_CODES#P`, this method would
throw an `https://developer.android.com/reference/java/lang/IllegalStateException` if this builder was constructed without a
`https://developer.android.com/reference/android/widget/RemoteViews`. Android `https://developer.android.com/reference/android/os/Build.VERSION_CODES#P` and
higher removed this restriction because datasets used as an
`https://developer.android.com/reference/android/view/autofill/AutofillManager#EXTRA_AUTHENTICATION_RESULT` do not need a presentation. But if you don't set the presentation
in the constructor in a dataset that is meant to be shown to the user, the autofill UI
for this field will not be displayed.

**Note:** On Android `https://developer.android.com/reference/android/os/Build.VERSION_CODES#P` and
higher, datasets that require authentication can be also be filtered by passing a
`https://developer.android.com/reference/android/view/autofill/AutofillValue#forText(java.lang.CharSequence)` as the `value` parameter.

<br />

| Parameters ||
|---|---|
| `id` | `AutofillId`: id returned by `https://developer.android.com/reference/android/app/assist/AssistStructure.ViewNode#getAutofillId()`. This value cannot be `null`. <br /> |
| `value` | `AutofillValue`: 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. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/service/autofill/Dataset.Builder` | this builder. This value cannot be `null`. <br /> |

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

### setValue

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

```
public Dataset.Builder setValue (AutofillId id, 
                AutofillValue value, 
                Pattern filter, 
                RemoteViews presentation, 
                InlinePresentation inlinePresentation, 
                InlinePresentation inlineTooltipPresentation)
```


**This method was deprecated
in API level 33.**   

Use `https://developer.android.com/reference/android/service/autofill/Dataset.Builder#setField(android.view.autofill.AutofillId,%20android.service.autofill.Field)` instead.

Sets the value of a field, using a custom `https://developer.android.com/reference/android/widget/RemoteViews` to
visualize it and a [explicit filter](https://developer.android.com/reference/android/service/autofill/Dataset.Builder#Filtering), and an
`https://developer.android.com/reference/android/service/autofill/InlinePresentation` to visualize it as an inline suggestion.

<br />

| Parameters ||
|---|---|
| `id` | `AutofillId`: id returned by `https://developer.android.com/reference/android/app/assist/AssistStructure.ViewNode#getAutofillId()`. This value cannot be `null`. <br /> |
| `value` | `AutofillValue`: 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. <br /> |
| `filter` | `Pattern`: 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). <br /> |
| `presentation` | `RemoteViews`: the presentation used to visualize this field. This value cannot be `null`. <br /> |
| `inlinePresentation` | `InlinePresentation`: The `https://developer.android.com/reference/android/service/autofill/InlinePresentation` used to visualize this dataset as inline suggestions. If the dataset supports inline suggestions, this should not be null. <br /> |
| `inlineTooltipPresentation` | `InlinePresentation`: The `https://developer.android.com/reference/android/service/autofill/InlinePresentation` used to show the tooltip for the `inlinePresentation`. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/service/autofill/Dataset.Builder` | this builder. This value cannot be `null`. <br /> |

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

**See also:**

- `https://developer.android.com/reference/android/service/autofill/Dataset.Builder#setValue(android.view.autofill.AutofillId,%20android.view.autofill.AutofillValue,%20java.util.regex.Pattern,%20android.widget.RemoteViews,%20android.service.autofill.InlinePresentation)`

### setValue

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

```
public Dataset.Builder setValue (AutofillId id, 
                AutofillValue value, 
                RemoteViews presentation, 
                InlinePresentation inlinePresentation)
```


**This method was deprecated
in API level 33.**   

Use `https://developer.android.com/reference/android/service/autofill/Dataset.Builder#setField(android.view.autofill.AutofillId,%20android.service.autofill.Field)` instead.

Sets the value of a field, using a custom `https://developer.android.com/reference/android/widget/RemoteViews` to
visualize it and an `https://developer.android.com/reference/android/service/autofill/InlinePresentation` to visualize it as an inline suggestion.

**Note:** If the dataset requires authentication but the service knows its text
value it's easier to filter by calling
`https://developer.android.com/reference/android/service/autofill/Dataset.Builder#setValue(android.view.autofill.AutofillId,%20android.view.autofill.AutofillValue,%20android.widget.RemoteViews)` and using the value to filter.

<br />

| Parameters ||
|---|---|
| `id` | `AutofillId`: id returned by `https://developer.android.com/reference/android/app/assist/AssistStructure.ViewNode#getAutofillId()`. This value cannot be `null`. <br /> |
| `value` | `AutofillValue`: 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. <br /> |
| `presentation` | `RemoteViews`: the presentation used to visualize this field. This value cannot be `null`. <br /> |
| `inlinePresentation` | `InlinePresentation`: The `https://developer.android.com/reference/android/service/autofill/InlinePresentation` used to visualize this dataset as inline suggestions. If the dataset supports inline suggestions, this should not be null. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/service/autofill/Dataset.Builder` | this builder. This value cannot be `null`. <br /> |

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

### setValue

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

```
public Dataset.Builder setValue (AutofillId id, 
                AutofillValue value, 
                RemoteViews presentation, 
                InlinePresentation inlinePresentation, 
                InlinePresentation inlineTooltipPresentation)
```


**This method was deprecated
in API level 33.**   

Use `https://developer.android.com/reference/android/service/autofill/Dataset.Builder#setField(android.view.autofill.AutofillId,%20android.service.autofill.Field)` instead.

Sets the value of a field, using a custom `https://developer.android.com/reference/android/widget/RemoteViews` to
visualize it and an `https://developer.android.com/reference/android/service/autofill/InlinePresentation` to visualize it as an inline suggestion.

<br />

| Parameters ||
|---|---|
| `id` | `AutofillId`: id returned by `https://developer.android.com/reference/android/app/assist/AssistStructure.ViewNode#getAutofillId()`. This value cannot be `null`. <br /> |
| `value` | `AutofillValue`: 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. <br /> |
| `presentation` | `RemoteViews`: the presentation used to visualize this field. This value cannot be `null`. <br /> |
| `inlinePresentation` | `InlinePresentation`: The `https://developer.android.com/reference/android/service/autofill/InlinePresentation` used to visualize this dataset as inline suggestions. If the dataset supports inline suggestions, this should not be null. <br /> |
| `inlineTooltipPresentation` | `InlinePresentation`: The `https://developer.android.com/reference/android/service/autofill/InlinePresentation` used to show the tooltip for the `inlinePresentation`. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/service/autofill/Dataset.Builder` | this builder. This value cannot be `null`. <br /> |

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

**See also:**

- `https://developer.android.com/reference/android/service/autofill/Dataset.Builder#setValue(android.view.autofill.AutofillId,%20android.view.autofill.AutofillValue,%20android.widget.RemoteViews,%20android.service.autofill.InlinePresentation)`

### setValue

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

```
public Dataset.Builder setValue (AutofillId id, 
                AutofillValue value, 
                Pattern filter, 
                RemoteViews presentation)
```


**This method was deprecated
in API level 33.**   

Use `https://developer.android.com/reference/android/service/autofill/Dataset.Builder#setField(android.view.autofill.AutofillId,%20android.service.autofill.Field)` instead.

Sets the value of a field, using a custom `https://developer.android.com/reference/android/widget/RemoteViews` to
visualize it and a [explicit filter](https://developer.android.com/reference/android/service/autofill/Dataset.Builder#Filtering).

This method is typically used when the dataset requires authentication and the service
does not know its value but wants to hide the dataset after the user enters a minimum
number of characters. For example, if the dataset represents a credit card number and the
service does not want to show the "Tap to authenticate" message until the user tapped
4 digits, in which case the filter would be `Pattern.compile("\\d.{4,}")`.

**Note:** If the dataset requires authentication but the service knows its text
value it's easier to filter by calling
`https://developer.android.com/reference/android/service/autofill/Dataset.Builder#setValue(android.view.autofill.AutofillId,%20android.view.autofill.AutofillValue,%20android.widget.RemoteViews)` and using the value to filter.

<br />

| Parameters ||
|---|---|
| `id` | `AutofillId`: id returned by `https://developer.android.com/reference/android/app/assist/AssistStructure.ViewNode#getAutofillId()`. This value cannot be `null`. <br /> |
| `value` | `AutofillValue`: 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. <br /> |
| `filter` | `Pattern`: 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). <br /> |
| `presentation` | `RemoteViews`: the presentation used to visualize this field. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/service/autofill/Dataset.Builder` | this builder. This value cannot be `null`. <br /> |

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