Android APIs
public static final class

RemoteInput.Builder

extends Object
java.lang.Object
   ↳ android.app.RemoteInput.Builder

Class Overview

Builder class for RemoteInput objects.

Summary

Public Constructors
RemoteInput.Builder(String resultKey)
Create a builder object for RemoteInput objects.
Public Methods
RemoteInput.Builder addExtras(Bundle extras)
Merge additional metadata into this builder.
RemoteInput build()
Combine all of the options that have been set and return a new RemoteInput object.
Bundle getExtras()
Get the metadata Bundle used by this Builder.
RemoteInput.Builder setAllowFreeFormInput(boolean allowFreeFormInput)
Specifies whether the user can provide arbitrary values.
RemoteInput.Builder setChoices(CharSequence[] choices)
Specifies choices available to the user to satisfy this input.
RemoteInput.Builder setLabel(CharSequence label)
Set a label to be displayed to the user when collecting this input.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public RemoteInput.Builder (String resultKey)

Added in API level 20

Create a builder object for RemoteInput objects.

Parameters
resultKey the Bundle key that refers to this input when collected from the user

Public Methods

public RemoteInput.Builder addExtras (Bundle extras)

Added in API level 20

Merge additional metadata into this builder.

Values within the Bundle will replace existing extras values in this Builder.

See Also

public RemoteInput build ()

Added in API level 20

Combine all of the options that have been set and return a new RemoteInput object.

public Bundle getExtras ()

Added in API level 20

Get the metadata Bundle used by this Builder.

The returned Bundle is shared with this Builder.

public RemoteInput.Builder setAllowFreeFormInput (boolean allowFreeFormInput)

Added in API level 20

Specifies whether the user can provide arbitrary values.

Parameters
allowFreeFormInput The default is true. If you specify false, you must provide a non-null and non-empty array to setChoices(CharSequence[]) or an IllegalArgumentException is thrown.
Returns
  • this object for method chaining

public RemoteInput.Builder setChoices (CharSequence[] choices)

Added in API level 20

Specifies choices available to the user to satisfy this input.

Parameters
choices an array of pre-defined choices for users input. You must provide a non-null and non-empty array if you disabled free form input using setAllowFreeFormInput(boolean).
Returns
  • this object for method chaining

public RemoteInput.Builder setLabel (CharSequence label)

Added in API level 20

Set a label to be displayed to the user when collecting this input.

Parameters
label The label to show to users when they input a response.
Returns
  • this object for method chaining