Android 12 Developer Preview is here! Try it out, and give us your feedback!

ItemList

public final class ItemList
extends Object

java.lang.Object
   ↳ androidx.car.app.model.ItemList


Represents a list of Item instances. ItemList instances are used by templates that contain lists of models, such as for example, the list of Rows in a ListTemplate.

Summary

Nested classes

class ItemList.Builder

A builder of ItemList

interface ItemList.OnItemVisibilityChangedListener

A listener for handling item visibility changes. 

interface ItemList.OnSelectedListener

A listener for handling selection events for lists with selectable items. 

Public methods

boolean equals(Object other)
List<Item> getItems()

Returns the list of items in this ItemList.

CarText getNoItemsMessage()

Returns the app-supplied text to be displayed if the list is empty or null if the default text will be used by the host.

OnItemVisibilityChangedDelegate getOnItemVisibilityChangedDelegate()

Returns the OnItemVisibilityChangedDelegate to be called when the visible items in the list changes or null if one hasn't been set.

OnSelectedDelegate getOnSelectedDelegate()

Returns the OnSelectedDelegate to be called when when an item is selected by the user or null is the list is non-selectable.

int getSelectedIndex()

Returns the index of the selected item of the list.

int hashCode()
String toString()

Inherited methods

Public methods

equals

public boolean equals (Object other)

Parameters
other Object

Returns
boolean

getItems

public List<Item> getItems ()

Returns the list of items in this ItemList.

Returns
List<Item>

getNoItemsMessage

public CarText getNoItemsMessage ()

Returns the app-supplied text to be displayed if the list is empty or null if the default text will be used by the host.

Returns
CarText

getOnItemVisibilityChangedDelegate

public OnItemVisibilityChangedDelegate getOnItemVisibilityChangedDelegate ()

Returns the OnItemVisibilityChangedDelegate to be called when the visible items in the list changes or null if one hasn't been set.

Returns
OnItemVisibilityChangedDelegate

getOnSelectedDelegate

public OnSelectedDelegate getOnSelectedDelegate ()

Returns the OnSelectedDelegate to be called when when an item is selected by the user or null is the list is non-selectable.

Returns
OnSelectedDelegate

getSelectedIndex

public int getSelectedIndex ()

Returns the index of the selected item of the list.

Returns
int

hashCode

public int hashCode ()

Returns
int

toString

public String toString ()

Returns
String