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

*** ** * ** ***


```
public final class Pane.Builder
```

<br />

*** ** * ** ***

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

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/car/app/model/Pane.Builder#Builder()()` Returns an empty `https://developer.android.com/reference/androidx/car/app/model/Pane.Builder` instance. |

| ### Public methods |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/car/app/model/Pane.Builder` | `https://developer.android.com/reference/androidx/car/app/model/Pane.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 alongside the rows in the pane. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/car/app/model/Pane.Builder` | `https://developer.android.com/reference/androidx/car/app/model/Pane.Builder#addRow(androidx.car.app.model.Row)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/car/app/model/Row row)` Adds a row to display in the list. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/car/app/model/Pane` | `https://developer.android.com/reference/androidx/car/app/model/Pane.Builder#build()()` Constructs the row list defined by this builder. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/car/app/model/Pane.Builder` | `@https://developer.android.com/reference/androidx/car/app/annotations/RequiresCarApi(value = 4) https://developer.android.com/reference/androidx/car/app/model/Pane.Builder#setImage(androidx.car.app.model.CarIcon)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/car/app/model/CarIcon image)` Sets an `https://developer.android.com/reference/androidx/car/app/model/CarIcon` to display alongside the rows in the pane. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/car/app/model/Pane.Builder` | `https://developer.android.com/reference/androidx/car/app/model/Pane.Builder#setLoading(boolean)(boolean isLoading)` Sets whether the `https://developer.android.com/reference/androidx/car/app/model/Pane` is in a loading state. |

## Public constructors

### Builder

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

```
public Builder()
```

Returns an empty `https://developer.android.com/reference/androidx/car/app/model/Pane.Builder` instance.

## Public methods

### addAction

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

```
public @NonNull Pane.Builder addAction(@NonNull Action action)
```

Adds an `https://developer.android.com/reference/androidx/car/app/model/Action` to display alongside the rows in the pane.

By default, no actions are displayed.

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

### addRow

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

```
public @NonNull Pane.Builder addRow(@NonNull Row row)
```

Adds a row to display in the list.

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

### build

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

```
public @NonNull Pane build()
```

Constructs the row list defined by this builder.

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException.html` | if the pane is in loading state and also contains rows, or vice versa |

### setImage

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

```
@RequiresCarApi(value = 4)
public @NonNull Pane.Builder setImage(@NonNull CarIcon image)
```

Sets an `https://developer.android.com/reference/androidx/car/app/model/CarIcon` to display alongside the rows in the pane.

#### Image Sizing Guidance

To minimize scaling artifacts across a wide range of car screens, apps should provide images targeting a 480 x 480 dp bounding box. If the image exceeds this maximum size in either one of the dimensions, it will be scaled down to be centered inside the bounding box while preserving its aspect ratio.

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

### setLoading

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

```
public @NonNull Pane.Builder setLoading(boolean isLoading)
```

Sets whether the `https://developer.android.com/reference/androidx/car/app/model/Pane` is in a loading state.

If set to `true`, the UI will display a loading indicator where the list content 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 set to `false`, the UI shows the actual row contents.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/car/app/model/Pane.Builder#build()` |   |