# MessageTemplate

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/MessageTemplate.java+class:androidx.car.app.model.MessageTemplate) 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/MessageTemplate "View this page in Java")


```
@CarProtocol
class MessageTemplate : Template
```

<br />

*** ** * ** ***

A template for displaying a message and associated actions.

#### 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 title and messages have not changed.

## Summary

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

| ### Public functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/MessageTemplate#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?` | `@https://developer.android.com/reference/kotlin/androidx/car/app/annotations/RequiresCarApi(value = 2) [getActionStrip](https://developer.android.com/reference/kotlin/androidx/car/app/model/MessageTemplate#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/model/MessageTemplate#getActions()()` Returns the list of actions to display in the template. |
| `https://developer.android.com/reference/kotlin/androidx/car/app/model/CarText?` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/MessageTemplate#getDebugMessage()()` Returns a debug message to display in the template or `null` if not set. |
| `https://developer.android.com/reference/kotlin/androidx/car/app/model/Header?` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/MessageTemplate#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/MessageTemplate#getHeaderAction())()` **This function is deprecated.** use `https://developer.android.com/reference/kotlin/androidx/car/app/model/Header#getStartHeaderAction()` instead. <br /> |
| `https://developer.android.com/reference/kotlin/androidx/car/app/model/CarIcon?` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/MessageTemplate#getIcon()()` Returns the icon to display in the template or `null` if not set. |
| `https://developer.android.com/reference/kotlin/androidx/car/app/model/CarText` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/MessageTemplate#getMessage()()` Returns the message to display in the template. |
| `https://developer.android.com/reference/kotlin/androidx/car/app/model/CarText?` | `[getTitle](https://developer.android.com/reference/kotlin/androidx/car/app/model/MessageTemplate#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/MessageTemplate#hashCode()()` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `@https://developer.android.com/reference/kotlin/androidx/car/app/annotations/RequiresCarApi(value = 2) https://developer.android.com/reference/kotlin/androidx/car/app/model/MessageTemplate#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/MessageTemplate#toString()()` |

## Public functions

### equals

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

### getActionStrip

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

```
@RequiresCarApi(value = 2)
fun [getActionStrip](https://developer.android.com/reference/kotlin/androidx/car/app/model/MessageTemplate#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.

### getActions

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

```
fun getActions(): (Mutable)List<Action!>
```

Returns the list of actions to display in the template.

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

### getDebugMessage

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

```
fun getDebugMessage(): CarText?
```

Returns a debug message to display in the template or `null` if not set.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/car/app/model/MessageTemplate.Builder#setDebugMessage(java.lang.Throwable)` |   |
| `https://developer.android.com/reference/kotlin/androidx/car/app/model/MessageTemplate.Builder#setDebugMessage(java.lang.String)` |   |

### 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/MessageTemplate.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/MessageTemplate#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.

### getIcon

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

```
fun getIcon(): CarIcon?
```

Returns the icon to display in the template or `null` if not set.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/car/app/model/MessageTemplate.Builder#setIcon(androidx.car.app.model.CarIcon)` |   |

### getMessage

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

```
fun getMessage(): CarText
```

Returns the message to display in the template.

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

### 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/MessageTemplate#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.

### hashCode

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

### isLoading

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

```
@RequiresCarApi(value = 2)
fun isLoading(): Boolean
```

Returns whether the template is loading.

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

### toString

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