RemoteInput.Builder
public final class RemoteInput.Builder
Builder class for androidx.core.app.RemoteInput objects.
Summary
Public constructors |
|---|
|
Create a builder object for |
Public methods |
|
|---|---|
@NonNull RemoteInput.Builder |
Merge additional metadata into this builder. |
@NonNull RemoteInput |
build()Combine all of the options that have been set and return a new |
@NonNull Bundle |
Get the metadata Bundle used by this Builder. |
@NonNull RemoteInput.Builder |
setAllowDataType(@NonNull String mimeType, boolean doAllow)Specifies whether the user can provide arbitrary values. |
@NonNull RemoteInput.Builder |
setAllowFreeFormInput(boolean allowFreeFormTextInput)Specifies whether the user can provide arbitrary text values. |
@NonNull RemoteInput.Builder |
setChoices(@Nullable CharSequence[] choices)Specifies choices available to the user to satisfy this input. |
@NonNull RemoteInput.Builder |
setEditChoicesBeforeSending(int editChoicesBeforeSending)Specifies whether tapping on a choice should let the user edit the input before it is sent to the app. |
@NonNull RemoteInput.Builder |
setLabel(@Nullable CharSequence label)Set a label to be displayed to the user when collecting this input. |
Public constructors
Public methods
addExtras
public @NonNull RemoteInput.Builder addExtras(@NonNull Bundle extras)
Merge additional metadata into this builder.
Values within the Bundle will replace existing extras values in this Builder.
| See also | |
|---|---|
getExtras |
build
public @NonNull RemoteInput build()
Combine all of the options that have been set and return a new androidx.core.app.RemoteInput object.
getExtras
public @NonNull Bundle getExtras()
Get the metadata Bundle used by this Builder.
The returned Bundle is shared with this Builder.
setAllowDataType
public @NonNull RemoteInput.Builder setAllowDataType(@NonNull String mimeType, boolean doAllow)
Specifies whether the user can provide arbitrary values.
| Parameters | |
|---|---|
@NonNull String mimeType |
A mime type that results are allowed to come in. Be aware that text results (see |
boolean doAllow |
Whether the mime type should be allowed or not |
| Returns | |
|---|---|
@NonNull RemoteInput.Builder |
this object for method chaining |
setAllowFreeFormInput
public @NonNull RemoteInput.Builder setAllowFreeFormInput(boolean allowFreeFormTextInput)
Specifies whether the user can provide arbitrary text values.
| Parameters | |
|---|---|
boolean allowFreeFormTextInput |
The default is |
| Returns | |
|---|---|
@NonNull RemoteInput.Builder |
this object for method chaining |
setChoices
public @NonNull RemoteInput.Builder setChoices(@Nullable CharSequence[] choices)
Specifies choices available to the user to satisfy this input.
Note: Starting in Android P, these choices will always be shown on phones if the app's target SDK is >= P. However, these choices may also be rendered on other types of devices regardless of target SDK.
| Parameters | |
|---|---|
@Nullable CharSequence[] 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 |
| Returns | |
|---|---|
@NonNull RemoteInput.Builder |
this object for method chaining |
setEditChoicesBeforeSending
public @NonNull RemoteInput.Builder setEditChoicesBeforeSending(int editChoicesBeforeSending)
Specifies whether tapping on a choice should let the user edit the input before it is sent to the app. The default is EDIT_CHOICES_BEFORE_SENDING_AUTO. It cannot be used if setAllowFreeFormInput has been set to false.
setLabel
public @NonNull RemoteInput.Builder setLabel(@Nullable CharSequence label)
Set a label to be displayed to the user when collecting this input.
| Parameters | |
|---|---|
@Nullable CharSequence label |
The label to show to users when they input a response |
| Returns | |
|---|---|
@NonNull RemoteInput.Builder |
this object for method chaining |