Class CarRow

java.lang.Object
com.codename1.car.CarRow

public class CarRow extends Object

A single selectable row in a CarListTemplate. Maps to androidx.car.app.model.Row and to a CPListItem on CarPlay. A row has a primary title, an optional secondary text line, an optional leading image and an activation listener.

CarRow track = new CarRow("Take Five")
        .setText("Dave Brubeck")
        .setImage(albumArt)
        .setOnAction(ctx -> play(trackId));
  • Constructor Details

    • CarRow

      public CarRow()
      Creates an empty row.
    • CarRow

      public CarRow(String title)

      Creates a row with the supplied title.

      Parameters
      • title: the primary line
  • Method Details

    • getTitle

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

      public CarRow setTitle(String title)

      Sets the primary title.

      Parameters
      • title: the primary line
      Returns

      this row, for chaining

    • getText

      public String getText()
      Returns the secondary text line, or null.
    • setText

      public CarRow setText(String text)

      Sets the secondary text line shown under the title.

      Parameters
      • text: the secondary line
      Returns

      this row, for chaining

    • getImage

      public Image getImage()
      Returns the leading image, or null.
    • setImage

      public CarRow setImage(Image image)

      Sets the leading image (album art, POI thumbnail, icon).

      Parameters
      • image: the leading image
      Returns

      this row, for chaining

    • isBrowsable

      public boolean isBrowsable()
      Returns true when this row drills into a sub-screen (renders a chevron).
    • setBrowsable

      public CarRow setBrowsable(boolean browsable)

      Marks this row as browsable, i.e. selecting it pushes a deeper CarScreen (the head unit renders a disclosure chevron). Set this for rows whose listener pushes another screen.

      Parameters
      • browsable: true to render a drill-in affordance
      Returns

      this row, for chaining

    • getOnAction

      public CarActionListener getOnAction()
      Returns the activation listener, or null.
    • setOnAction

      public CarRow setOnAction(CarActionListener listener)

      Sets the listener invoked (on the EDT) when the row is selected.

      Parameters
      • listener: the activation callback
      Returns

      this row, for chaining