Class CarRow
java.lang.Object
com.codename1.car.CarRow
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetImage()Returns the leading image, or null.Returns the activation listener, or null.getText()Returns the secondary text line, or null.getTitle()Returns the primary title.booleanReturns true when this row drills into a sub-screen (renders a chevron).setBrowsable(boolean browsable) Marks this row as browsable, i.e.Sets the leading image (album art, POI thumbnail, icon).setOnAction(CarActionListener listener) Sets the listener invoked (on the EDT) when the row is selected.Sets the secondary text line shown under the title.Sets the primary title.
-
Constructor Details
-
CarRow
public CarRow()Creates an empty row. -
CarRow
Creates a row with the supplied title.
Parameters
title: the primary line
-
-
Method Details
-
getTitle
Returns the primary title. -
setTitle
-
getText
Returns the secondary text line, or null. -
setText
-
getImage
Returns the leading image, or null. -
setImage
-
isBrowsable
public boolean isBrowsable()Returns true when this row drills into a sub-screen (renders a chevron). -
setBrowsable
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
Returns the activation listener, or null. -
setOnAction
Sets the listener invoked (on the EDT) when the row is selected.
Parameters
listener: the activation callback
Returns
this row, for chaining
-