Class CarAction
java.lang.Object
com.codename1.car.CarAction
A tappable action -- a button shown in a CarActionStrip, a header action, or an action attached
to a CarPaneTemplate / CarMessageTemplate. Maps to androidx.car.app.model.Action and to a
CPBarButton / CPAlertAction on CarPlay. Use the fluent setters to configure it:
CarAction refresh = new CarAction("Refresh")
.setIcon(refreshIcon)
.setOnAction(ctx -> screen.invalidate());
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the requested background colour role.getIcon()Returns the action icon, or null.Returns the activation listener, or null.getTitle()Returns the action label, or null if icon-only.setBackgroundColor(CarColor backgroundColor) Sets the background colour role (the head unit may ignore it for legibility).Sets the action icon.setOnAction(CarActionListener listener) Sets the listener invoked (on the EDT) when the action is selected.Sets the action label.
-
Constructor Details
-
CarAction
public CarAction()Creates an empty action. Set at least a title or an icon before use. -
CarAction
Creates an action with the supplied title.
Parameters
title: the action label
-
-
Method Details
-
getTitle
Returns the action label, or null if icon-only. -
setTitle
-
getIcon
Returns the action icon, or null. -
setIcon
-
getBackgroundColor
Returns the requested background colour role. -
setBackgroundColor
-
getOnAction
Returns the activation listener, or null. -
setOnAction
Sets the listener invoked (on the EDT) when the action is selected.
Parameters
listener: the activation callback
Returns
this action, for chaining
-