# Status.Builder

Artifact: [androidx.wear:wear-ongoing](https://developer.android.com/jetpack/androidx/releases/wear) [View Source](https://cs.android.com/search?q=file:androidx/wear/ongoing/Status.java+class:androidx.wear.ongoing.Status.Builder) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear#1.0.0)

*** ** * ** ***


```
public final class Status.Builder
```

<br />

*** ** * ** ***

Helper to Build OngoingActivityStatus instances. Templates can be specified, to specify how to render the parts and any surrounding text/format. If no template is specified, a default template that concatenates all parts separated by space is used.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/wear/ongoing/Status.Builder#Builder()()` |

| ### Public methods |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/ongoing/Status.Builder` | `https://developer.android.com/reference/androidx/wear/ongoing/Status.Builder#addPart(java.lang.String,androidx.wear.ongoing.Status.Part)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html name, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/ongoing/Status.Part part)` Add a part to be inserted in the placeholders. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/ongoing/Status.Builder` | `https://developer.android.com/reference/androidx/wear/ongoing/Status.Builder#addTemplate(java.lang.CharSequence)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/CharSequence.html template)` Add a template to use for this status. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/ongoing/Status` | `https://developer.android.com/reference/androidx/wear/ongoing/Status.Builder#build()()` Build an OngoingActivityStatus with the given parameters. |

## Public constructors

### Builder

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

```
public Builder()
```

## Public methods

### addPart

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

```
public @NonNull Status.Builder addPart(@NonNull String name, @NonNull Status.Part part)
```

Add a part to be inserted in the placeholders.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html name` | the name of this part. In the template, use this name surrounded by '#' to reference it, e.g. here "track" and in the template "#track#" |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/ongoing/Status.Part part` | The part that will be rendered in the specified position/s in the template. |

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/ongoing/Status.Builder` | this builder, to chain calls. |

### addTemplate

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

```
public @NonNull Status.Builder addTemplate(@NonNull CharSequence template)
```

Add a template to use for this status. Placeholders can be defined with #name# To produce a '#', use '##' in the template. If multiple templates are specified, the first one (in the order they where added by calling this method) that has all required fields is used. If no template is specified, a default template that concatenates all parts separated by space is used.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/CharSequence.html template` | the template to be added |

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/ongoing/Status.Builder` | this builder, to chain calls. |

### build

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

```
public @NonNull Status build()
```

Build an OngoingActivityStatus with the given parameters.

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/ongoing/Status` | the built OngoingActivityStatus |