# InCallTemplate.Builder

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

*** ** * ** ***


```
public final class InCallTemplate.Builder
```

<br />

*** ** * ** ***

A builder for `https://developer.android.com/reference/androidx/car/app/dialer/InCallTemplate`.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/car/app/dialer/InCallTemplate.Builder#Builder()()` Returns a `https://developer.android.com/reference/androidx/car/app/dialer/InCallTemplate.Builder` instance with no values set by default. |
| `https://developer.android.com/reference/androidx/car/app/dialer/InCallTemplate.Builder#Builder(androidx.car.app.dialer.InCallTemplate)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/car/app/dialer/InCallTemplate template)` Returns a `https://developer.android.com/reference/androidx/car/app/dialer/InCallTemplate.Builder` instance with values from the template. |

| ### Public methods |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/car/app/dialer/InCallTemplate.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/car/app/dialer/InCallTemplate.Builder#addAction(androidx.car.app.model.Action)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/car/app/model/Action action)` Adds an `https://developer.android.com/reference/androidx/car/app/model/Action` to display. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/car/app/dialer/InCallTemplate.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/car/app/dialer/InCallTemplate.Builder#addText(androidx.car.app.model.CarText)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/car/app/model/CarText text)` Adds a text string below the title, with support for multiple length variants. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/car/app/dialer/InCallTemplate.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/car/app/dialer/InCallTemplate.Builder#addText(java.lang.CharSequence)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/CharSequence.html text)` Adds a text string below the title, with support for multiple length variants. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/car/app/dialer/InCallTemplate` | `https://developer.android.com/reference/androidx/car/app/dialer/InCallTemplate.Builder#build()()` Constructs the `https://developer.android.com/reference/androidx/car/app/dialer/InCallTemplate` defined by this builder. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/car/app/dialer/InCallTemplate.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/car/app/dialer/InCallTemplate.Builder#setHeader(androidx.car.app.model.Header)(@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/car/app/model/Header header)` Sets the header to show in the template. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/car/app/dialer/InCallTemplate.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/car/app/dialer/InCallTemplate.Builder#setIcon(androidx.car.app.model.CarIcon)(@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/car/app/model/CarIcon icon)` Sets the icon that appears in the body of the template. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/car/app/dialer/InCallTemplate.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/car/app/dialer/InCallTemplate.Builder#setLoading(boolean)(boolean isLoading)` Sets whether the template is in a loading state. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/car/app/dialer/InCallTemplate.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/car/app/dialer/InCallTemplate.Builder#setTitle(androidx.car.app.model.CarText)(@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/car/app/model/CarText title)` Sets the title shown in the template body. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/car/app/dialer/InCallTemplate.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/car/app/dialer/InCallTemplate.Builder#setTitle(java.lang.CharSequence)(@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/CharSequence.html title)` Sets the title shown in the template body. |

## Public constructors

### Builder

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

```
public Builder()
```

Returns a `https://developer.android.com/reference/androidx/car/app/dialer/InCallTemplate.Builder` instance with no values set by default.

### Builder

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

```
public Builder(@NonNull InCallTemplate template)
```

Returns a `https://developer.android.com/reference/androidx/car/app/dialer/InCallTemplate.Builder` instance with values from the template.

## Public methods

### addAction

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

```
@CanIgnoreReturnValue
public @NonNull InCallTemplate.Builder addAction(@NonNull Action action)
```

Adds an `https://developer.android.com/reference/androidx/car/app/model/Action` to display.

#### Requirements

This template allows up to 5 `https://developer.android.com/reference/androidx/car/app/model/Action`s in its body. Each action must have an icon and cannot have a title. A single action may be flagged with `https://developer.android.com/reference/androidx/car/app/model/Action#FLAG_PRIMARY()`.

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/NullPointerException.html` | if `action` is `null` |
| `https://developer.android.com/reference/java/lang/IllegalArgumentException.html` | if `action` does not meet the requirements |

### addText

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

```
@CanIgnoreReturnValue
public @NonNull InCallTemplate.Builder addText(@NonNull CarText text)
```

Adds a text string below the title, with support for multiple length variants.

A maximum of {@value #MAX_TEXTS_SIZE} text strings can be added.

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/NullPointerException.html` | if `text` is `null` |
| `https://developer.android.com/reference/java/lang/IllegalArgumentException.html` | if `text` contains unsupported spans |

### addText

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

```
@CanIgnoreReturnValue
public @NonNull InCallTemplate.Builder addText(@NonNull CharSequence text)
```

Adds a text string below the title, with support for multiple length variants.

A maximum of {@value #MAX_TEXTS_SIZE} text strings can be added.

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/NullPointerException.html` | if `text` is `null` |
| `https://developer.android.com/reference/java/lang/IllegalArgumentException.html` | if `text` contains unsupported spans |

### build

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

```
public @NonNull InCallTemplate build()
```

Constructs the `https://developer.android.com/reference/androidx/car/app/dialer/InCallTemplate` defined by this builder.

### setHeader

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

```
@CanIgnoreReturnValue
public @NonNull InCallTemplate.Builder setHeader(@Nullable Header header)
```

Sets the header to show in the template.

If a start `https://developer.android.com/reference/androidx/car/app/model/Action` is set in the `https://developer.android.com/reference/androidx/car/app/model/Header`, it must conform to the constraints in .

### setIcon

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

```
@CanIgnoreReturnValue
public @NonNull InCallTemplate.Builder setIcon(@Nullable CarIcon icon)
```

Sets the icon that appears in the body of the template.

Note that the `https://developer.android.com/reference/androidx/car/app/model/Header` may also contain an icon in the form of a start header `https://developer.android.com/reference/androidx/car/app/model/Action`.

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException.html` | if the `https://developer.android.com/reference/androidx/car/app/model/CarIcon` does not meet the constraints in . |

### setLoading

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

```
@CanIgnoreReturnValue
public @NonNull InCallTemplate.Builder setLoading(boolean isLoading)
```

Sets whether the template is in a loading state.

If set to `true`, the UI shows a loading indicator where text list and actions would be otherwise. The caller is expected to call `https://developer.android.com/reference/androidx/car/app/Screen#invalidate()` and send the new template content to the host once the data is ready. If template content is set this must be `false` or an exception will be thrown in `https://developer.android.com/reference/androidx/car/app/dialer/InCallTemplate.Builder#build()`.

### setTitle

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

```
@CanIgnoreReturnValue
public @NonNull InCallTemplate.Builder setTitle(@Nullable CarText title)
```

Sets the title shown in the template body.

Note that `https://developer.android.com/reference/androidx/car/app/dialer/InCallTemplate.Builder#setHeader(androidx.car.app.model.Header)` also has title which shows above the template body.

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException.html` | if the `https://developer.android.com/reference/androidx/car/app/model/CarText` does not meet the constraints in . |

### setTitle

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

```
@CanIgnoreReturnValue
public @NonNull InCallTemplate.Builder setTitle(@Nullable CharSequence title)
```

Sets the title shown in the template body.

Note that `https://developer.android.com/reference/androidx/car/app/dialer/InCallTemplate.Builder#setHeader(androidx.car.app.model.Header)` also has title which shows above the template body.

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException.html` | if the `https://developer.android.com/reference/java/lang/CharSequence.html` does not meet the constraints in . |