# Print output for @column tags ?>
Developers

- Design
- Develop
- Distribute

Developer Console

## Most visited

## Recently visited

## Results for

Summary: Ctors | Methods | Inherited Methods

# UserData.Builder

`public static final class UserData.Builder`
`extends Object` ``

java.lang.Object
↳ | android.service.autofill.UserData.Builder

A builder for `UserData` objects.

## Summary

### Public constructors
`Builder(String id, String value, String categoryId)` Creates a new builder for the user data used for field classification.

### Public methods
`UserData.Builder` | `add(String value, String categoryId)` Adds a new value for user data.
`UserData` | `build()` Creates a new `UserData` instance.
`UserData.Builder` | `setFieldClassificationAlgorithm(String name, Bundle args)` Sets the default algorithm used for field classification.
`UserData.Builder` | `setFieldClassificationAlgorithmForCategory(String categoryId, String name, Bundle args)` Sets the algorithm used for field classification for the specified category.

### Inherited methods
From class `java.lang.Object`
`Object` | `clone()` Creates and returns a copy of this object.
`boolean` | `equals(Object obj)` Indicates whether some other object is "equal to" this one.
`void` | `finalize()` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
`final Class<?>` | `getClass()` Returns the runtime class of this `Object`.
`int` | `hashCode()` Returns a hash code value for the object.
`final void` | `notify()` Wakes up a single thread that is waiting on this object's monitor.
`final void` | `notifyAll()` Wakes up all threads that are waiting on this object's monitor.
`String` | `toString()` Returns a string representation of the object.
`final void` | `wait(long timeout, int nanos)` Causes the current thread to wait until another thread invokes the `notify()` method or the `notifyAll()` method for this object, or some other thread interrupts the current thread, or a certain amount of real time has elapsed.
`final void` | `wait(long timeout)` Causes the current thread to wait until either another thread invokes the `notify()` method or the `notifyAll()` method for this object, or a specified amount of time has elapsed.
`final void` | `wait()` Causes the current thread to wait until another thread invokes the `notify()` method or the `notifyAll()` method for this object.

## Public constructors

### Builder

    public Builder (String id,
                    String value,
                    String categoryId)

Creates a new builder for the user data used for field classification.

The user data must contain at least one pair of `value` -> `categoryId`, and more pairs can be added through the `add(java.lang.String, java.lang.String)` method. For example:

     new UserData.Builder("v1", "Bart Simpson", "name")
       .add("bart.simpson@example.com", "email")
       .add("el_barto@example.com", "email")
       .build();

Parameters
`id` | `String`: id used to identify the whole `UserData` object. This id is also returned by `AutofillManager#getUserDataId()`, which can be used to check if the `UserData` is up-to-date without fetching the whole object (through `AutofillManager#getUserData()`). This value cannot be `null`.
`value` | `String`: value of the user data. This value cannot be `null`.
`categoryId` | `String`: autofill field category. This value cannot be `null`.

Throws
`IllegalArgumentException` | if any of the following occurs: `id` is empty `categoryId` is empty `value` is empty the length of `value` is lower than `UserData#getMinValueLength()` the length of `value` is higher than `UserData#getMaxValueLength()`

## Public methods

### add

    public UserData.Builder add (String value,
                    String categoryId)

Adds a new value for user data.

Parameters
`value` | `String`: value of the user data. This value cannot be `null`.
`categoryId` | `String`: string used to identify the category the value is associated with. This value cannot be `null`.

Returns
`UserData.Builder` | This value cannot be `null`.

Throws
`IllegalStateException` | if: `build()` already called the `value` has already been added (Note: this restriction was lifted on Android `Build.VERSION_CODES.Q` and later) the number of unique `categoryId` values added so far is more than `UserData#getMaxCategoryCount()` the number of `values` added so far is is more than `UserData#getMaxUserDataSize()`
`IllegalArgumentException` | if any of the following occurs: `id` is empty `categoryId` is empty `value` is empty the length of `value` is lower than `UserData#getMinValueLength()` the length of `value` is higher than `UserData#getMaxValueLength()`

### build

    public UserData build ()

Creates a new `UserData` instance.

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

Returns
`UserData` | The built dataset. This value cannot be `null`.

Throws
`IllegalStateException` | if `build()` was already called.

### setFieldClassificationAlgorithm

    public UserData.Builder setFieldClassificationAlgorithm (String name,
                    Bundle args)

Sets the default algorithm used for field classification.

The currently available algorithms can be retrieve through `AutofillManager#getAvailableFieldClassificationAlgorithms()`.

If not set, the `default algorithm` is used instead.

Parameters
`name` | `String`: name of the algorithm or `null` to used default. This value may be `null`.
`args` | `Bundle`: optional arguments to the algorithm. This value may be `null`.

Returns
`UserData.Builder` | this builder

### setFieldClassificationAlgorithmForCategory

    public UserData.Builder setFieldClassificationAlgorithmForCategory (String categoryId,
                    String name,
                    Bundle args)

Sets the algorithm used for field classification for the specified category.

The currently available algorithms can be retrieved through `AutofillManager#getAvailableFieldClassificationAlgorithms()`.

If not set, the `default algorithm` is used instead.

Parameters
`categoryId` | `String`: autofill field category. This value cannot be `null`.
`name` | `String`: name of the algorithm or `null` to used default. This value may be `null`.
`args` | `Bundle`: optional arguments to the algorithm. This value may be `null`.

Returns
`UserData.Builder` | this builder

Full name *
Email address *
Company / developer name
One of your Play Store app URLs *
Which best describes your business:*
Apps
Games
Apps & Games
*
*