Class CarGridItem

java.lang.Object
com.codename1.car.CarGridItem

public class CarGridItem extends Object
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.
  • 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
      • title: the item label

      • image: the item image

  • Method Details

    • getTitle

      public String getTitle()
      Returns the item title.
    • setTitle

      public CarGridItem setTitle(String title)

      Sets the item title.

      Parameters
      • title: 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
      • text: 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
      • image: 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
      • listener: the activation callback
      Returns

      this item, for chaining