public static final class RemoteInput.Builder extends Object
RemoteInput
objects.Constructor and Description |
---|
Builder(String resultKey)
Create a builder object for
RemoteInput objects. |
Modifier and Type | Method and Description |
---|---|
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.
|
public Builder(String resultKey)
RemoteInput
objects.resultKey
- the Bundle key that refers to this input when collected from the userpublic RemoteInput.Builder setLabel(CharSequence label)
label
- The label to show to users when they input a response.public RemoteInput.Builder setChoices(CharSequence[] choices)
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)
.public RemoteInput.Builder setAllowFreeFormInput(boolean allowFreeFormInput)
allowFreeFormInput
- The default is true
.
If you specify false
, you must provide a non-null
and non-empty array to setChoices(java.lang.CharSequence[])
or an
IllegalArgumentException
is thrown.public RemoteInput.Builder addExtras(Bundle extras)
Values within the Bundle will replace existing extras values in this Builder.
RemoteInput.getExtras()
public Bundle getExtras()
The returned Bundle is shared with this Builder.
public RemoteInput build()
RemoteInput
object.