# TabTemplate

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/TabTemplate.java+class:androidx.car.app.model.TabTemplate) Added in [1.3.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.3.0)

*** ** * ** ***


```
@CarProtocol
@RequiresCarApi(value = 6)
class TabTemplate : Template
```

<br />

*** ** * ** ***

A template representing a list of tabs and contents for the active tab.

#### 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/TabTemplate.Builder#setLoading(boolean)`} , or
- The `https://developer.android.com/reference/kotlin/androidx/car/app/model/Tab`s structure between the templates has not changed and if the new template has the same active tab then the contents of that tab hasn't changed. This means that if the previous template has multiple `https://developer.android.com/reference/kotlin/androidx/car/app/model/Tab`s, the new template must have the same number of tabs with the same title and icon.

## Summary

| ### Nested types |
|---|
| `class https://developer.android.com/reference/kotlin/androidx/car/app/model/TabTemplate.Builder` A builder of `https://developer.android.com/reference/kotlin/androidx/car/app/model/TabTemplate`. |
| `interface https://developer.android.com/reference/kotlin/androidx/car/app/model/TabTemplate.TabCallback` A listener for tab selection. |

| ### Public functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/TabTemplate#equals(java.lang.Object)(other: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?)` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/TabTemplate#getActiveTabContentId()()` Returns the `https://developer.android.com/reference/kotlin/androidx/car/app/model/Tab#getContentId()` for the active tab. |
| `https://developer.android.com/reference/kotlin/androidx/car/app/model/Action?` | `@https://developer.android.com/reference/kotlin/androidx/car/app/annotations/RequiresCarApi(value = 9) @https://developer.android.com/reference/kotlin/androidx/car/app/annotations/ExperimentalCarApi https://developer.android.com/reference/kotlin/androidx/car/app/model/TabTemplate#getEndAction()()` Returns the end action displayed in the tab bar, or `null` if none has been set. |
| `https://developer.android.com/reference/kotlin/androidx/car/app/model/Action` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/TabTemplate#getHeaderAction()()` 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. |
| `https://developer.android.com/reference/kotlin/androidx/car/app/model/TabStyle?` | `@https://developer.android.com/reference/kotlin/androidx/car/app/annotations/RequiresCarApi(value = 9) @https://developer.android.com/reference/kotlin/androidx/car/app/annotations/ExperimentalCarApi https://developer.android.com/reference/kotlin/androidx/car/app/model/TabTemplate#getStyle()()` Returns the `https://developer.android.com/reference/kotlin/androidx/car/app/model/TabStyle` for tabs in the template, or `null` if not set. |
| `https://developer.android.com/reference/kotlin/androidx/car/app/model/TabCallbackDelegate` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/TabTemplate#getTabCallbackDelegate()()` Returns the `https://developer.android.com/reference/kotlin/androidx/car/app/model/TabCallbackDelegate` for tab related callbacks. |
| `https://developer.android.com/reference/kotlin/androidx/car/app/model/TabContents` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/TabTemplate#getTabContents()()` Returns the `https://developer.android.com/reference/kotlin/androidx/car/app/model/TabContents` for the currently active tab. |
| `(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/Tab!>` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/TabTemplate#getTabs()()` Returns the list of `https://developer.android.com/reference/kotlin/androidx/car/app/model/Tab`s in the template. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/TabTemplate#hashCode()()` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/TabTemplate#isLoading()()` Returns whether the template is loading. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/TabTemplate#toString()()` |

## Public functions

### equals

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

### getActiveTabContentId

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

```
fun getActiveTabContentId(): String
```

Returns the `https://developer.android.com/reference/kotlin/androidx/car/app/model/Tab#getContentId()` for the active tab.

### getEndAction

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

```
@RequiresCarApi(value = 9)
@ExperimentalCarApi
fun getEndAction(): Action?
```

Returns the end action displayed in the tab bar, or `null` if none has been set.

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

### getHeaderAction

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

```
fun getHeaderAction(): Action
```

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/TabTemplate.Builder#setHeaderAction(androidx.car.app.model.Action)` |   |

### getStyle

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

```
@RequiresCarApi(value = 9)
@ExperimentalCarApi
fun getStyle(): TabStyle?
```

Returns the `https://developer.android.com/reference/kotlin/androidx/car/app/model/TabStyle` for tabs in the template, or `null` if not set.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/car/app/model/TabTemplate.Builder#setStyle(androidx.car.app.model.TabStyle)` |   |

### getTabCallbackDelegate

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

```
fun getTabCallbackDelegate(): TabCallbackDelegate
```

Returns the `https://developer.android.com/reference/kotlin/androidx/car/app/model/TabCallbackDelegate` for tab related callbacks.

### getTabContents

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

```
fun getTabContents(): TabContents
```

Returns the `https://developer.android.com/reference/kotlin/androidx/car/app/model/TabContents` for the currently active tab.

### getTabs

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

```
fun getTabs(): (Mutable)List<Tab!>
```

Returns the list of `https://developer.android.com/reference/kotlin/androidx/car/app/model/Tab`s in the template.

### hashCode

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

### isLoading

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

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

Returns whether the template is loading.

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

### toString

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