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

*** ** * ** ***

<br />

```
class MapWithContentTemplate.Builder
```

<br />

*** ** * ** ***

A builder of `https://developer.android.com/reference/kotlin/androidx/car/app/navigation/model/MapWithContentTemplate`.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/car/app/navigation/model/MapWithContentTemplate.Builder#Builder()()` |

| ### Public functions |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/car/app/navigation/model/MapWithContentTemplate` | `https://developer.android.com/reference/kotlin/androidx/car/app/navigation/model/MapWithContentTemplate.Builder#build()()` Constructs the template defined by this builder. |
| `https://developer.android.com/reference/kotlin/androidx/car/app/navigation/model/MapWithContentTemplate.Builder` | `https://developer.android.com/reference/kotlin/androidx/car/app/navigation/model/MapWithContentTemplate.Builder#setActionStrip(androidx.car.app.model.ActionStrip)(actionStrip: https://developer.android.com/reference/kotlin/androidx/car/app/model/ActionStrip)` Sets the `https://developer.android.com/reference/kotlin/androidx/car/app/model/ActionStrip` for this template. |
| `https://developer.android.com/reference/kotlin/androidx/car/app/navigation/model/MapWithContentTemplate.Builder` | `https://developer.android.com/reference/kotlin/androidx/car/app/navigation/model/MapWithContentTemplate.Builder#setContentTemplate(androidx.car.app.model.Template)(template: https://developer.android.com/reference/kotlin/androidx/car/app/model/Template)` Sets the content to be displayed on top of the map tiles. |
| `https://developer.android.com/reference/kotlin/androidx/car/app/navigation/model/MapWithContentTemplate.Builder` | `https://developer.android.com/reference/kotlin/androidx/car/app/navigation/model/MapWithContentTemplate.Builder#setMapController(androidx.car.app.navigation.model.MapController)(mapController: https://developer.android.com/reference/kotlin/androidx/car/app/navigation/model/MapController)` Sets the `https://developer.android.com/reference/kotlin/androidx/car/app/navigation/model/MapController` for this template. |

## Public constructors

### Builder

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

```
Builder()
```

## Public functions

### build

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

```
fun build(): MapWithContentTemplate
```

Constructs the template defined by this builder.

#### Requirements

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException.html` | if the template is not one of the allowed Content types See `https://developer.android.com/reference/kotlin/androidx/car/app/navigation/model/MapWithContentTemplate.Builder#setContentTemplate(androidx.car.app.model.Template)` for the list of supported content templates. |

### setActionStrip

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

```
fun setActionStrip(actionStrip: ActionStrip): MapWithContentTemplate.Builder
```

Sets the `https://developer.android.com/reference/kotlin/androidx/car/app/model/ActionStrip` for this template.

Unless set with this method, the template will not have an action strip.

The `https://developer.android.com/reference/kotlin/androidx/car/app/model/Action` buttons in Map Based Template are automatically adjusted based on the screen size. On narrow width screen, icon `https://developer.android.com/reference/kotlin/androidx/car/app/model/Action`s show by default. If no icon specify, showing title `https://developer.android.com/reference/kotlin/androidx/car/app/model/Action`s instead. On wider width screen, title `https://developer.android.com/reference/kotlin/androidx/car/app/model/Action`s show by default. If no title specify, showing icon `https://developer.android.com/reference/kotlin/androidx/car/app/model/Action`s instead.

#### Requirements

This template allows up to 4 `https://developer.android.com/reference/kotlin/androidx/car/app/model/Action`s in its `https://developer.android.com/reference/kotlin/androidx/car/app/model/ActionStrip`. Of the 4 allowed `https://developer.android.com/reference/kotlin/androidx/car/app/model/Action`s, it can either be a title `https://developer.android.com/reference/kotlin/androidx/car/app/model/Action` as set via `https://developer.android.com/reference/kotlin/androidx/car/app/model/Action.Builder#setTitle(java.lang.CharSequence)`, or a icon `https://developer.android.com/reference/kotlin/androidx/car/app/model/Action` as set via `https://developer.android.com/reference/kotlin/androidx/car/app/model/Action.Builder#setIcon(androidx.car.app.model.CarIcon)`.

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

### setContentTemplate

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

```
fun setContentTemplate(template: Template): MapWithContentTemplate.Builder
```

Sets the content to be displayed on top of the map tiles.

From Car API 7 onward, the following template types are supported as content:

- `ListTemplate`
- `PaneTemplate`
- `GridTemplate`
- `MessageTemplate`

From Car API 8 onward, the following template type is supported as content in addition to all previously supported template types:

- `SectionedItemTemplate`

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

### setMapController

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

```
fun setMapController(mapController: MapController): MapWithContentTemplate.Builder
```

Sets the `https://developer.android.com/reference/kotlin/androidx/car/app/navigation/model/MapController` for this template.