Suggestion.Builder
public final class Suggestion.Builder
A builder of Suggestion.
Summary
Public methods |
|
|---|---|
@NonNull Suggestion |
build()Constructs the |
@NonNull Suggestion.Builder |
setAction(@NonNull PendingIntent action)Sets the |
@NonNull Suggestion.Builder |
Sets a suggestion image to display. |
@NonNull Suggestion.Builder |
setIdentifier(@NonNull String identifier)Sets the suggestion identifier. |
@NonNull Suggestion.Builder |
setSubtitle(@NonNull CharSequence subtitle)Sets the suggestion subtitle formatted for the user's current locale. |
@NonNull Suggestion.Builder |
setTitle(@NonNull CharSequence title)Sets the suggestion title formatted for the user's current locale. |
Public methods
build
public @NonNull Suggestion build()
Constructs the Suggestion defined by this builder.
| Throws | |
|---|---|
java.lang.IllegalStateException |
if any of the files are |
setAction
public @NonNull Suggestion.Builder setAction(@NonNull PendingIntent action)
Sets the PendingIntent for the suggestion action.
| Throws | |
|---|---|
java.lang.NullPointerException |
if |
setIcon
public @NonNull Suggestion.Builder setIcon(@NonNull CarIcon icon)
Sets a suggestion image to display.
Image Sizing Guidance To minimize scaling artifacts across a wide range of car screens, apps should provide images targeting a 128 x 128 dp bounding box. If the image exceeds this maximum size in either one of the dimensions, it will be scaled down to be centered inside the bounding box while preserving the aspect ratio. Icon images are expected to be tintable.See CarIcon for more details related to providing icon and image resources that work with different car screen pixel densities.
| Throws | |
|---|---|
java.lang.NullPointerException |
if |
setIdentifier
public @NonNull Suggestion.Builder setIdentifier(@NonNull String identifier)
Sets the suggestion identifier.
| Throws | |
|---|---|
java.lang.NullPointerException |
if |
setSubtitle
public @NonNull Suggestion.Builder setSubtitle(@NonNull CharSequence subtitle)
Sets the suggestion subtitle formatted for the user's current locale.
Spans are not supported in the input string and will be ignored.
| Throws | |
|---|---|
java.lang.NullPointerException |
if |
| See also | |
|---|---|
CarText |
setTitle
public @NonNull Suggestion.Builder setTitle(@NonNull CharSequence title)
Sets the suggestion title formatted for the user's current locale.
Spans are not supported in the input string and will be ignored.
| Throws | |
|---|---|
java.lang.NullPointerException |
if |
| See also | |
|---|---|
CarText |