public class CarGridItem
- Object
- CarGridItem
A single cell in a
CarGridTemplate: a large image with a short title and optional secondary
text. Maps to androidx.car.app.model.GridItem and to a CPGridButton on CarPlay. Grid items
are image-forward (browse categories, presets, playlists) – always supply an image.Constructors
public CarGridItem() | Creates an empty grid item. |
public CarGridItem(String title, Image image) | Creates a grid item with a title and image. |
Methods
public String getTitle() | Returns the item title. |
public CarGridItem setTitle(String title) | Sets the item title. |
public String getText() | Returns the secondary text line, or null. |
public CarGridItem setText(String text) | Sets the secondary text line. |
public Image getImage() | Returns the item image, or null. |
public CarGridItem setImage(Image image) | Sets the item image. |
public CarActionListener getOnAction() | Returns the activation listener, or null. |
public CarGridItem setOnAction(CarActionListener listener) | Sets the listener invoked (on the EDT) when the item is selected. |
Inherited methods
Constructor details
CarGridItem
public CarGridItem()Creates an empty grid item.
CarGridItem
public CarGridItem(String title, Image image)Creates a grid item with a title and image.
Parameters
titleString- the item label
imageImage- the item image
Method details
getTitle
public String getTitle()Returns the item title.
setTitle
public CarGridItem setTitle(String title)Sets the item title.
Parameters
titleString- the label
Returns
this item, for chaining
getText
public String getText()Returns the secondary text line, or null.
setText
public CarGridItem setText(String text)Sets the secondary text line.
Parameters
textString- the secondary line
Returns
this item, for chaining
getImage
public Image getImage()Returns the item image, or null.
setImage
public CarGridItem setImage(Image image)Sets the item image.
Parameters
imageImage- the image
Returns
this item, for chaining
getOnAction
public CarActionListener getOnAction()Returns the activation listener, or null.
setOnAction
public CarGridItem setOnAction(CarActionListener listener)Sets the listener invoked (on the EDT) when the item is selected.
Parameters
listenerCarActionListener- the activation callback
Returns
this item, for chaining