I wanted to show a list in the Car app Android for Android Auto. The list should contain items with two buttons for separate actions.
I tried adding the addAction(), but it doesn't seem to be available in Row Class. Could someone help me build a Row or a list item with two buttons, so that I can add it to the ItemList.Builder?
My current code is
ListTemplate.Builder templateBuilder = new ListTemplate.Builder();
ItemList.Builder itemList = new ItemList.Builder();
templateBuilder.setLoading(isLoading);
if(!isLoading) {
for (ParkingList parkingList : parkingList) {
Row rowItem = new Row.Builder()
.setTitle(parkingList.getNome())
.setImage(new CarIcon.Builder(
IconCompat.createWithResource(
getCarContext(),
R.drawable.ic_launcher_foreground))
.build(),
Row.IMAGE_TYPE_LARGE)
.setBrowsable(false)
.addText(parkingList.getDescrizione())
.addText(parkingList.getLat() + " " + parkingList.getLng())
.setOnClickListener(
() ->
getScreenManager()
.push(new NextScreen(getCarContext())))
.build();
itemList.addItem(rowItem);
}
ItemList templateList = itemList.build();
templateBuilder.setSingleList(templateList);
}
return templateBuilder.setTitle("Parking List").build();