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

*** ** * ** ***

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


```
class MapController.Builder
```

<br />

*** ** * ** ***

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

## Summary

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

| ### Public functions |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/car/app/navigation/model/MapController` | `https://developer.android.com/reference/kotlin/androidx/car/app/navigation/model/MapController.Builder#build()()` Constructs the `https://developer.android.com/reference/kotlin/androidx/car/app/navigation/model/MapController` defined by this builder. |
| `https://developer.android.com/reference/kotlin/androidx/car/app/navigation/model/MapController.Builder` | `https://developer.android.com/reference/kotlin/androidx/car/app/navigation/model/MapController.Builder#setMapActionStrip(androidx.car.app.model.ActionStrip)(actionStrip: https://developer.android.com/reference/kotlin/androidx/car/app/model/ActionStrip)` Sets an `https://developer.android.com/reference/kotlin/androidx/car/app/model/ActionStrip` with a list of map-control related actions for the active template, such as pan or zoom. |
| `https://developer.android.com/reference/kotlin/androidx/car/app/navigation/model/MapController.Builder` | `https://developer.android.com/reference/kotlin/androidx/car/app/navigation/model/MapController.Builder#setPanModeListener(androidx.car.app.navigation.model.PanModeListener)(panModeListener: https://developer.android.com/reference/kotlin/androidx/car/app/navigation/model/PanModeListener)` Sets a `https://developer.android.com/reference/kotlin/androidx/car/app/navigation/model/PanModeListener` that notifies when the user enters and exits the pan mode. |

## Public constructors

### Builder

Added in 1.2.0

```
Builder()
```

## Public functions

### build

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

```
fun build(): MapController
```

Constructs the `https://developer.android.com/reference/kotlin/androidx/car/app/navigation/model/MapController` defined by this builder.

### setMapActionStrip

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

```
fun setMapActionStrip(actionStrip: ActionStrip): MapController.Builder
```

Sets an `https://developer.android.com/reference/kotlin/androidx/car/app/model/ActionStrip` with a list of map-control related actions for the active template, such as pan or zoom.

The host will draw the buttons in an area that is associated with map controls.

If the app does not include the `https://developer.android.com/reference/kotlin/androidx/car/app/model/Action#PAN()` button in this `https://developer.android.com/reference/kotlin/androidx/car/app/model/ActionStrip`, the app will not receive the user input for panning gestures from `https://developer.android.com/reference/kotlin/androidx/car/app/SurfaceCallback` methods, and the host will exit any previously activated pan mode.

#### Requirements

This component allows up to 4 `https://developer.android.com/reference/kotlin/androidx/car/app/model/Action`s in its map `https://developer.android.com/reference/kotlin/androidx/car/app/model/ActionStrip`. Only `https://developer.android.com/reference/kotlin/androidx/car/app/model/Action`s with icons set via `https://developer.android.com/reference/kotlin/androidx/car/app/model/Action.Builder#setIcon(androidx.car.app.model.CarIcon)` are allowed.

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

### setPanModeListener

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

```
fun setPanModeListener(panModeListener: PanModeListener): MapController.Builder
```

Sets a `https://developer.android.com/reference/kotlin/androidx/car/app/navigation/model/PanModeListener` that notifies when the user enters and exits the pan mode.

If the app does not include the `https://developer.android.com/reference/kotlin/androidx/car/app/model/Action#PAN()` button in the map `https://developer.android.com/reference/kotlin/androidx/car/app/model/ActionStrip`, the app will not receive the user input for panning gestures from `https://developer.android.com/reference/kotlin/androidx/car/app/SurfaceCallback` methods, and the host will exit any previously activated pan mode.

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/NullPointerException.html` | if `panModeListener` is `null` |