# Status.Builder

# 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)

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/wear/ongoing/Status.Builder "View this page in Java")

<br />

```
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                                            |
|--------------------------------------------------------------------------------------------------------------|
| [Builder](https://developer.android.com/reference/kotlin/androidx/wear/ongoing/Status.Builder#Builder())`()` |

|                                         ### Public functions                                          |
|-------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Status.Builder](https://developer.android.com/reference/kotlin/androidx/wear/ongoing/Status.Builder) | [addPart](https://developer.android.com/reference/kotlin/androidx/wear/ongoing/Status.Builder#addPart(java.lang.String,androidx.wear.ongoing.Status.Part))`(name: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`, part: `[Status.Part](https://developer.android.com/reference/kotlin/androidx/wear/ongoing/Status.Part)`)` Add a part to be inserted in the placeholders. |
| [Status.Builder](https://developer.android.com/reference/kotlin/androidx/wear/ongoing/Status.Builder) | [addTemplate](https://developer.android.com/reference/kotlin/androidx/wear/ongoing/Status.Builder#addTemplate(java.lang.CharSequence))`(template: `[CharSequence](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html)`)` Add a template to use for this status.                                                                                                                     |
| [Status](https://developer.android.com/reference/kotlin/androidx/wear/ongoing/Status)                 | [build](https://developer.android.com/reference/kotlin/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)  

```
Builder()
```  

## Public functions

### addPart

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

```
fun addPart(name: String, part: Status.Part): Status.Builder
```

Add a part to be inserted in the placeholders.  

|                                               Parameters                                                |
|---------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------|
| `name: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)               | 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#" |
| `part: `[Status.Part](https://developer.android.com/reference/kotlin/androidx/wear/ongoing/Status.Part) | The part that will be rendered in the specified position/s in the template.                                                              |

|                                                Returns                                                |
|-------------------------------------------------------------------------------------------------------|-------------------------------|
| [Status.Builder](https://developer.android.com/reference/kotlin/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)  

```
fun addTemplate(template: CharSequence): Status.Builder
```

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                                                 |
|------------------------------------------------------------------------------------------------------------|--------------------------|
| `template: `[CharSequence](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html) | the template to be added |

|                                                Returns                                                |
|-------------------------------------------------------------------------------------------------------|-------------------------------|
| [Status.Builder](https://developer.android.com/reference/kotlin/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)  

```
fun build(): Status
```

Build an OngoingActivityStatus with the given parameters.  

|                                        Returns                                        |
|---------------------------------------------------------------------------------------|---------------------------------|
| [Status](https://developer.android.com/reference/kotlin/androidx/wear/ongoing/Status) | the built OngoingActivityStatus |