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

GridTemplate

public final class GridTemplate
extends Object implements Template

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


A template representing a grid of items.

Template Restrictions

In regards to template refreshes, as described in Screen.onGetTemplate(), this template is considered a refresh of a previous one if:
  • The template title has not changed, and
  • The previous template is in a loading state (see GridTemplate.Builder.setLoading(boolean), or the number of grid items and the title of each grid item have not changed.

Summary

Nested classes

class GridTemplate.Builder

A builder of GridTemplate

Public methods

boolean equals(Object other)
ActionStrip getActionStrip()

Returns the ActionStrip for this template or null if not set.

Action getHeaderAction()

Returns the Action that is set to be displayed in the header of the template, or null if not set.

ItemList getSingleList()

Returns the ItemList instance that contains the grid items to display or null if not set.

CarText getTitle()

Returns the title of the template or null if not set.

int hashCode()
boolean isLoading()

Returns whether the template is loading.

String toString()

Inherited methods

Public methods

equals

public boolean equals (Object other)

Parameters
other Object

Returns
boolean

getActionStrip

public ActionStrip getActionStrip ()

Returns the ActionStrip for this template or null if not set.

Returns
ActionStrip

getHeaderAction

public Action getHeaderAction ()

Returns the Action that is set to be displayed in the header of the template, or null if not set.

Returns
Action

getSingleList

public ItemList getSingleList ()

Returns the ItemList instance that contains the grid items to display or null if not set.

Returns
ItemList

getTitle

public CarText getTitle ()

Returns the title of the template or null if not set.

Returns
CarText

hashCode

public int hashCode ()

Returns
int

isLoading

public boolean isLoading ()

Returns whether the template is loading.

Returns
boolean

toString

public String toString ()

Returns
String