# ListTemplate

Artifact: [androidx.car.app:app](https://developer.android.com/jetpack/androidx/releases/car-app) [View Source](https://cs.android.com/search?q=file:androidx/car/app/model/ListTemplate.java+class:androidx.car.app.model.ListTemplate) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.0.0)

*** ** * ** ***

Kotlin \|[Java](https://developer.android.com/reference/androidx/car/app/model/ListTemplate "View this page in Java")


```
@CarProtocol
class ListTemplate : Template
```

<br />

*** ** * ** ***

A template representing a list of items.

#### Template Restrictions

In regards to template refreshes, as described in `https://developer.android.com/reference/kotlin/androidx/car/app/Screen#onGetTemplate()`, this template is considered a refresh of a previous one if:

- The previous template is in a loading state (see `https://developer.android.com/reference/kotlin/androidx/car/app/model/ListTemplate.Builder#setLoading(boolean)`}, or
- The template title has not changed, and the `https://developer.android.com/reference/kotlin/androidx/car/app/model/ItemList` structure between the templates have not changed. This means that if the previous template has multiple `https://developer.android.com/reference/kotlin/androidx/car/app/model/ItemList` sections, the new template must have the same number of sections with the same headers. Further, the number of rows and the title (not counting spans) of each row must not have changed.
- For rows that contain a `https://developer.android.com/reference/kotlin/androidx/car/app/model/Toggle`, updates to the title are also allowed if the toggle state has changed between the previous and new templates.

## Summary

| ### Nested types |
|---|
| `class https://developer.android.com/reference/kotlin/androidx/car/app/model/ListTemplate.Builder` A builder of `https://developer.android.com/reference/kotlin/androidx/car/app/model/ListTemplate`. |

| ### Public functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/ListTemplate#equals(java.lang.Object)(other: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?)` |
| `https://developer.android.com/reference/kotlin/androidx/car/app/model/ActionStrip?` | `[getActionStrip](https://developer.android.com/reference/kotlin/androidx/car/app/model/ListTemplate#getActionStrip())()` **This function is deprecated.** use `https://developer.android.com/reference/kotlin/androidx/car/app/model/Header#getEndHeaderActions()` instead. <br /> |
| `(https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/car/app/model/Action!>` | `@https://developer.android.com/reference/kotlin/androidx/car/app/annotations/RequiresCarApi(value = 6) https://developer.android.com/reference/kotlin/androidx/car/app/model/ListTemplate#getActions()()` Returns the list of additional actions. |
| `https://developer.android.com/reference/kotlin/androidx/car/app/model/Header?` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/ListTemplate#getHeader()()` Returns the `https://developer.android.com/reference/kotlin/androidx/car/app/model/Header` to display in this template. |
| `https://developer.android.com/reference/kotlin/androidx/car/app/model/Action?` | `[getHeaderAction](https://developer.android.com/reference/kotlin/androidx/car/app/model/ListTemplate#getHeaderAction())()` **This function is deprecated.** use `https://developer.android.com/reference/kotlin/androidx/car/app/model/Header#getStartHeaderAction()` instead. <br /> |
| `(https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/car/app/model/SectionedItemList!>` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/ListTemplate#getSectionedLists()()` Returns the list of `https://developer.android.com/reference/kotlin/androidx/car/app/model/SectionedItemList` instances to be displayed in the template. |
| `https://developer.android.com/reference/kotlin/androidx/car/app/model/ItemList?` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/ListTemplate#getSingleList()()` Returns the `https://developer.android.com/reference/kotlin/androidx/car/app/model/ItemList` instance containing the list of items to display or ` null` if one hasn't been set. |
| `https://developer.android.com/reference/kotlin/androidx/car/app/model/CarText?` | `[getTitle](https://developer.android.com/reference/kotlin/androidx/car/app/model/ListTemplate#getTitle())()` **This function is deprecated.** use `https://developer.android.com/reference/kotlin/androidx/car/app/model/Header#getTitle()` instead. <br /> |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/ListTemplate#hashCode()()` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/ListTemplate#isLoading()()` Returns whether the template is loading. |
| `https://developer.android.com/reference/kotlin/androidx/car/app/model/ListTemplate.Builder` | `@https://developer.android.com/reference/kotlin/androidx/car/app/annotations/ExperimentalCarApi https://developer.android.com/reference/kotlin/androidx/car/app/model/ListTemplate#toBuilder()()` Creates and returns a new `https://developer.android.com/reference/kotlin/androidx/car/app/model/ListTemplate.Builder` initialized with this `https://developer.android.com/reference/kotlin/androidx/car/app/model/ListTemplate`'s data. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/ListTemplate#toString()()` |

## Public functions

### equals

```
fun equals(other: Any?): Boolean
```

### getActionStrip

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.0.0) Deprecated in [1.7.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.7.0)

```
fun [getActionStrip](https://developer.android.com/reference/kotlin/androidx/car/app/model/ListTemplate#getActionStrip())(): ActionStrip?
```

> [!CAUTION]
> **This function is deprecated.**   
>
> use `https://developer.android.com/reference/kotlin/androidx/car/app/model/Header#getEndHeaderActions()` instead.

Returns the `https://developer.android.com/reference/kotlin/androidx/car/app/model/ActionStrip` for this template or `null` if not set.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/car/app/model/ListTemplate.Builder#setActionStrip(androidx.car.app.model.ActionStrip)` |   |

### getActions

Added in [1.4.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.4.0)

```
@RequiresCarApi(value = 6)
fun getActions(): (Mutable)List<Action!>
```

Returns the list of additional actions.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/car/app/model/ListTemplate.Builder#addAction(androidx.car.app.model.Action)` |   |

### getHeader

Added in [1.7.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.7.0)

```
fun getHeader(): Header?
```

Returns the `https://developer.android.com/reference/kotlin/androidx/car/app/model/Header` to display in this template.

This method was introduced in API 7, but is backwards compatible even if the client is using API 6 or below.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/car/app/model/ListTemplate.Builder#setHeader(androidx.car.app.model.Header)` |   |

### getHeaderAction

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.0.0) Deprecated in [1.7.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.7.0)

```
fun [getHeaderAction](https://developer.android.com/reference/kotlin/androidx/car/app/model/ListTemplate#getHeaderAction())(): Action?
```

> [!CAUTION]
> **This function is deprecated.**   
>
> use `https://developer.android.com/reference/kotlin/androidx/car/app/model/Header#getStartHeaderAction()` instead.

Returns the `https://developer.android.com/reference/kotlin/androidx/car/app/model/Action` that is set to be displayed in the header of the template, or `null` if not set.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/car/app/model/ListTemplate.Builder#setHeaderAction(androidx.car.app.model.Action)` |   |

### getSectionedLists

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.0.0)

```
fun getSectionedLists(): (Mutable)List<SectionedItemList!>
```

Returns the list of `https://developer.android.com/reference/kotlin/androidx/car/app/model/SectionedItemList` instances to be displayed in the template.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/car/app/model/ListTemplate.Builder#addSectionedList(androidx.car.app.model.SectionedItemList)` |   |

### getSingleList

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.0.0)

```
fun getSingleList(): ItemList?
```

Returns the `https://developer.android.com/reference/kotlin/androidx/car/app/model/ItemList` instance containing the list of items to display or `
null` if one hasn't been set.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/car/app/model/ListTemplate.Builder#setSingleList(androidx.car.app.model.ItemList)` |   |

### getTitle

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.0.0) Deprecated in [1.7.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.7.0)

```
fun [getTitle](https://developer.android.com/reference/kotlin/androidx/car/app/model/ListTemplate#getTitle())(): CarText?
```

> [!CAUTION]
> **This function is deprecated.**   
>
> use `https://developer.android.com/reference/kotlin/androidx/car/app/model/Header#getTitle()` instead.

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

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/car/app/model/ListTemplate.Builder#setTitle(java.lang.CharSequence)` |   |

### hashCode

```
fun hashCode(): Int
```

### isLoading

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.0.0)

```
fun isLoading(): Boolean
```

Returns whether the template is loading.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/car/app/model/ListTemplate.Builder#setLoading(boolean)` |   |

### toBuilder

Added in [1.3.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.3.0)

```
@ExperimentalCarApi
fun toBuilder(): ListTemplate.Builder
```

Creates and returns a new `https://developer.android.com/reference/kotlin/androidx/car/app/model/ListTemplate.Builder` initialized with this `https://developer.android.com/reference/kotlin/androidx/car/app/model/ListTemplate`'s data.

### toString

```
fun toString(): String
```