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

*** ** * ** ***


```
public final class CarProgressBar.Builder
```

<br />

*** ** * ** ***

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

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/car/app/model/CarProgressBar.Builder#Builder(float)(@https://developer.android.com/reference/androidx/annotation/FloatRange(from = 0.0, to = 1.0) float progress)` Creates a builder with the specified progress. |

| ### Public methods |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/car/app/model/CarProgressBar` | `https://developer.android.com/reference/androidx/car/app/model/CarProgressBar.Builder#build()()` Constructs the `https://developer.android.com/reference/androidx/car/app/model/CarProgressBar` defined by this builder. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/car/app/model/CarProgressBar.Builder` | `https://developer.android.com/reference/androidx/car/app/model/CarProgressBar.Builder#setStyle(androidx.car.app.model.CarProgressBarStyle)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/car/app/model/CarProgressBarStyle style)` Sets the style of the progress bar. |

## Public constructors

### Builder

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

```
public Builder(@FloatRange(from = 0.0, to = 1.0) float progress)
```

Creates a builder with the specified progress.

Values outside the range \[0.0, 1.0\] will be coerced to the nearest bound.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/FloatRange(from = 0.0, to = 1.0) float progress` | the progress, from 0.0 to 1.0 |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException.html` | if `progress` is `NaN` or infinite |

## Public methods

### build

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

```
public @NonNull CarProgressBar build()
```

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

### setStyle

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

```
public @NonNull CarProgressBar.Builder setStyle(@NonNull CarProgressBarStyle style)
```

Sets the style of the progress bar.

If no style is set, a progress bar using `https://developer.android.com/reference/androidx/car/app/model/CarProgressBarStyle` with default values is rendered (see `https://developer.android.com/reference/androidx/car/app/model/CarProgressBarStyle.Builder`).

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