Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Ctors](https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder#pubctors) \| [Methods](https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder#inhmethods)

# ComplicationData.Builder


`
public
static
final

class
ComplicationData.Builder
`


`

extends Object


`

`


`

|---|---|
| java.lang.Object ||
| ↳ | com.google.wear.services.complications.ComplicationData.Builder |

<br />

*** ** * ** ***

Builder class for `https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData`.

## Summary

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder#Builder(com.google.wear.services.complications.ComplicationData)(https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData data) ` |
| ` https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder#Builder(int)(int type) ` |
| ` https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder#Builder(int,%20java.util.Map<java.lang.String,java.lang.Object>)(int type, Map<String, Object> fields) ` |

| ### Public methods ||
|---|---|
| ` https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData` | ` https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder#build()() ` Constructs and returns `https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData` with the provided fields. |
| ` https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder` | ` https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder#clearColorRampInterpolated()() ` Clears the value of the color ramp interpolated field. |
| ` https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder` | ` https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder#clearEndDateTime()() ` Removes the end time for this complication data. |
| ` https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder` | ` https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder#clearRangedMaxValue()() ` Clears the ranged max value for this Complication Data. |
| ` https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder` | ` https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder#clearRangedMinValue()() ` Clears the ranged min value for this Complication Data. |
| ` https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder` | ` https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder#clearRangedValue()() ` Removes the ranged value for this complication data. |
| ` https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder` | ` https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder#clearStartDateTime()() ` Removes the start time for this complication data. |
| ` https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder` | ` https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder#clearTargetValue()() ` Clears the target value for this Complication Data. |
| ` https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder` | ` https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder#setBurnInProtectionIcon(android.graphics.drawable.Icon)(Icon icon) ` Sets the burn-in protection version of the icon field. |
| ` https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder` | ` https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder#setBurnInProtectionSmallImage(android.graphics.drawable.Icon)(Icon smallImage) ` Sets the burn-in protection version of the small image field. |
| ` https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder` | ` https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder#setColorRamp(int[])(int[] colorRamp) ` Optional. |
| ` https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder` | ` https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder#setColorRampInterpolated(boolean)(boolean colorRampInterpolated) ` Optional. |
| ` https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder` | ` https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder#setContentDescription(com.google.wear.services.complications.ComplicationText)(https://developer.android.com/reference/com/google/wear/services/complications/ComplicationText description) ` Sets the content description field for accessibility. |
| ` https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder` | ` https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder#setDataSource(android.content.ComponentName)(ComponentName provider) ` Sets the `https://developer.android.com/reference/android/content/ComponentName` of the ComplicationDataSourceService that provided this ComplicationData. |
| ` https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder` | ` https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder#setDisplayPolicy(int)(int displayPolicy) ` Sets the complication's complication display policy. |
| ` https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder` | ` https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder#setElementBackgroundColor(int)(int elementBackgroundColor) ` Sets the background color to use between elements for this complication. |
| ` https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder` | ` https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder#setElementColors(int[])(int[] elementColors) ` Sets the element colors for this complication. |
| ` https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder` | ` https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder#setElementWeights(float[])(float[] elementWeights) ` Sets the element weights for this complication. |
| ` https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder` | ` https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder#setEndDateTimeMillis(long)(long endDateTimeMillis) ` Sets the end time for this complication data. |
| ` https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder` | ` https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder#setExtras(android.os.PersistableBundle)(PersistableBundle extras) ` Sets any extras. |
| ` https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder` | ` https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder#setIcon(android.graphics.drawable.Icon)(Icon icon) ` Sets the icon field for this Complication Data. |
| ` https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder` | ` https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder#setInvalidatedData(com.google.wear.services.complications.ComplicationData)(https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData invalidatedData) ` Sets the invalidated `https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationData`, used in `https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationType#NO_DATA` when generated by dynamic value invalidation. |
| ` https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder` | ` https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder#setLargeImage(android.graphics.drawable.Icon)(Icon largeImage) ` Sets the large image field for this Complication Data. |
| ` https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder` | ` https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder#setLongText(com.google.wear.services.complications.ComplicationText)(https://developer.android.com/reference/com/google/wear/services/complications/ComplicationText longText) ` Sets long text field. |
| ` https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder` | ` https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder#setLongTitle(com.google.wear.services.complications.ComplicationText)(https://developer.android.com/reference/com/google/wear/services/complications/ComplicationText longTitle) ` Sets the long title field for this Complication Data. |
| ` https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder` | ` https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder#setPersistencePolicy(int)(int cachePolicy) ` Sets the complication's `https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationPersistencePolicies`. |
| ` https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder` | ` https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder#setPlaceholder(com.google.wear.services.complications.ComplicationData)(https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData placeholder) ` Sets the placeholder. |
| ` https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder` | ` https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder#setRangedDynamicValue(com.google.wear.expression.ProtoLayoutDynamicFloat)(https://developer.android.com/reference/com/google/wear/expression/ProtoLayoutDynamicFloat value) ` Sets a dynamic float value for a ranged Complication Data. |
| ` https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder` | ` https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder#setRangedMaxValue(float)(float maxValue) ` Sets the ranged max value field for this Complication Data. |
| ` https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder` | ` https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder#setRangedMinValue(float)(float minValue) ` Sets the ranged min value field for this Complication Data. |
| ` https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder` | ` https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder#setRangedValue(float)(float value) ` Sets the ranged value field for this Complication Data. |
| ` https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder` | ` https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder#setRangedValueType(int)(int valueType) ` Sets the ranged value type field which provides meta data about the value. |
| ` https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder` | ` https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder#setShortText(com.google.wear.services.complications.ComplicationText)(https://developer.android.com/reference/com/google/wear/services/complications/ComplicationText shortText) ` Sets the short text field. |
| ` https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder` | ` https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder#setShortTitle(com.google.wear.services.complications.ComplicationText)(https://developer.android.com/reference/com/google/wear/services/complications/ComplicationText shortTitle) ` Sets the short title field. |
| ` https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder` | ` https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder#setSmallImage(android.graphics.drawable.Icon)(Icon smallImage) ` Sets the small image field for this Complication Data. |
| ` https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder` | ` https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder#setSmallImageStyle(int)(int imageStyle) ` Sets the display style for this complication data. |
| ` https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder` | ` https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder#setStartDateTimeMillis(long)(long startDateTimeMillis) ` Sets the start time for this complication data. |
| ` https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder` | ` https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder#setTapAction(android.app.PendingIntent)(PendingIntent pendingIntent) ` Sets the tap action field for this Complication Data. |
| ` https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder` | ` https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder#setTapActionLostDueToSerialization(boolean)(boolean tapActionLostDueToSerialization) ` Sets whether or not this ComplicationData has been serialized. |
| ` https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder` | ` https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder#setTargetValue(float)(float targetValue) ` Sets the ranged target value field for this Complication Data. |
| ` https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder` | ` https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder#setTimelineEndEpochSecond(long)(long epochSecond) ` For timeline entries. |
| ` https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder` | ` https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder#setTimelineEntries(java.util.Collection<com.google.wear.services.complications.ComplicationData>)(Collection<https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData> timelineEntries) ` Sets the list of `https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData` timeline entries. |
| ` https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder` | ` https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder#setTimelineStartEpochSecond(long)(long epochSecond) ` For timeline entries. |

| ### Inherited methods |
|---|---|
| From class ` java.lang.Object ` |---|---| | ` Object` | ` clone() ` | | ` boolean` | ` equals(Object arg0) ` | | ` void` | ` finalize() ` | | ` final Class<?>` | ` getClass() ` | | ` int` | ` hashCode() ` | | ` final void` | ` notify() ` | | ` final void` | ` notifyAll() ` | | ` String` | ` toString() ` | | ` final void` | ` wait(long arg0, int arg1) ` | | ` final void` | ` wait(long arg0) ` | | ` final void` | ` wait() ` | ||

## Public constructors

### Builder

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public Builder (ComplicationData data)
```

<br />

<br />

| Parameters ||
|---|---|
| `data` | `ComplicationData` <br /> |

### Builder

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public Builder (int type)
```

<br />

<br />

| Parameters ||
|---|---|
| `type` | `int` <br /> |

### Builder

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public Builder (int type, 
                Map<String, Object> fields)
```

<br />

<br />

| Parameters ||
|---|---|
| `type` | `int`: Value is one of the following: |
| `fields` | `Map` <br /> |

## Public methods

### build

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public ComplicationData build ()
```

Constructs and returns `https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData` with the provided fields. All required
fields must be populated before this method is called.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData` | <br /> |

| Throws ||
|---|---|
| `IllegalStateException` | if the required fields have not been populated |

### clearColorRampInterpolated

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public ComplicationData.Builder clearColorRampInterpolated ()
```

Clears the value of the color ramp interpolated field. No-op if the field is not set.

Returns this Builder to allow chaining.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder` | <br /> |

### clearEndDateTime

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public ComplicationData.Builder clearEndDateTime ()
```

Removes the end time for this complication data.

Returns this Builder to allow chaining.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder` | <br /> |

### clearRangedMaxValue

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public ComplicationData.Builder clearRangedMaxValue ()
```

Clears the ranged max value for this Complication Data.

Returns Builder to allow chaining.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder` | <br /> |

### clearRangedMinValue

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public ComplicationData.Builder clearRangedMinValue ()
```

Clears the ranged min value for this Complication Data.

Returns Builder to allow chaining.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder` | <br /> |

### clearRangedValue

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public ComplicationData.Builder clearRangedValue ()
```

Removes the ranged value for this complication data.

Returns this Builder to allow chaining.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder` | <br /> |

### clearStartDateTime

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public ComplicationData.Builder clearStartDateTime ()
```

Removes the start time for this complication data.

Returns this Builder to allow chaining.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder` | <br /> |

### clearTargetValue

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public ComplicationData.Builder clearTargetValue ()
```

Clears the target value for this Complication Data.

Returns Builder to allow chaining.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder` | <br /> |

### setBurnInProtectionIcon

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public ComplicationData.Builder setBurnInProtectionIcon (Icon icon)
```

Sets the burn-in protection version of the icon field. This should be provided if the
icon field is provided, unless the main icon is already safe for use with burn-in
protection. This icon should have fewer lit pixels, and should use darker colors to
prevent LCD burn in issues.

The provided image must be single-color, so that watch faces can tint it as required.

The provided image must not contain solid blocks of pixels - it should instead be
composed of outlines or lines only.

If this field is set, the icon field must also be set using `https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder#setIcon(android.graphics.drawable.Icon)`.

Returns this Builder to allow chaining.

<br />

| Parameters ||
|---|---|
| `icon` | `Icon` <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder` | <br /> |

| Throws ||
|---|---|
| `IllegalStateException` | if this field is not valid for the complication type |

### setBurnInProtectionSmallImage

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public ComplicationData.Builder setBurnInProtectionSmallImage (Icon smallImage)
```

Sets the burn-in protection version of the small image field. This should be provided if
the small image field is provided, unless the main small image is already safe for use
with burn-in protection.

The provided image must not contain solid blocks of pixels - it should instead be
composed of outlines or lines only.

If this field is set, the small image field must also be set using `https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder#setSmallImage(android.graphics.drawable.Icon)`.

Returns this Builder to allow chaining.

<br />

| Parameters ||
|---|---|
| `smallImage` | `Icon` <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder` | <br /> |

| Throws ||
|---|---|
| `IllegalStateException` | if this field is not valid for the complication type |

### setColorRamp

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public ComplicationData.Builder setColorRamp (int[] colorRamp)
```

Optional. Sets the color the color ramp should be drawn with.

Returns this Builder to allow chaining.

<br />

| Parameters ||
|---|---|
| `colorRamp` | `int` <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder` | <br /> |

### setColorRampInterpolated

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public ComplicationData.Builder setColorRampInterpolated (boolean colorRampInterpolated)
```

Optional. Sets whether or not the color ramp should be smoothly shaded or drawn with
steps.

Returns this Builder to allow chaining.

<br />

| Parameters ||
|---|---|
| `colorRampInterpolated` | `boolean` <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder` | <br /> |

### setContentDescription

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public ComplicationData.Builder setContentDescription (ComplicationText description)
```

Sets the content description field for accessibility. This is optional for any non-empty
type. It is recommended to provide a content description whenever the data includes an
image.

The provided text will be read aloud by a Text-to-speech converter for users who may
be vision-impaired. It will be read aloud in addition to any long, short, or range text
in the complication.

If using to describe an image/icon that is purely stylistic and doesn't convey any
information to the user, you may set the image content description to an empty string
("").

Returns this Builder to allow chaining.

<br />

| Parameters ||
|---|---|
| `description` | `ComplicationText` <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder` | <br /> |

### setDataSource

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public ComplicationData.Builder setDataSource (ComponentName provider)
```

Sets the `https://developer.android.com/reference/android/content/ComponentName` of the ComplicationDataSourceService that provided this
ComplicationData. Generally this field should be set and is only nullable for backwards
compatibility.

Returns this Builder to allow chaining.

<br />

| Parameters ||
|---|---|
| `provider` | `ComponentName` <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder` | <br /> |

### setDisplayPolicy

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public ComplicationData.Builder setDisplayPolicy (int displayPolicy)
```

Sets the complication's display policy.

<br />

| Parameters ||
|---|---|
| `displayPolicy` | `int`: Value is either `0` or a combination of the following: |

| Returns ||
|---|---|
| `https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder` | <br /> |

### setElementBackgroundColor

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public ComplicationData.Builder setElementBackgroundColor (int elementBackgroundColor)
```

Sets the background color to use between elements for this complication.

Returns this Builder to allow chaining.

<br />

| Parameters ||
|---|---|
| `elementBackgroundColor` | `int` <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder` | <br /> |

### setElementColors

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public ComplicationData.Builder setElementColors (int[] elementColors)
```

Sets the element colors for this complication.

Returns this Builder to allow chaining.

<br />

| Parameters ||
|---|---|
| `elementColors` | `int` <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder` | <br /> |

### setElementWeights

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public ComplicationData.Builder setElementWeights (float[] elementWeights)
```

Sets the element weights for this complication.

Returns this Builder to allow chaining.

<br />

| Parameters ||
|---|---|
| `elementWeights` | `float` <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder` | <br /> |

### setEndDateTimeMillis

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public ComplicationData.Builder setEndDateTimeMillis (long endDateTimeMillis)
```

Sets the end time for this complication data. This is optional for any type.

The complication data will be considered inactive (i.e. should not be displayed) if
the current time is greater than the end time. If not specified, the data is considered
active for all time after the start time (or always active if start time is also not
specified).

Any non-positive values of `endDateTimeMillis` will leave this field unset.

Returns this Builder to allow chaining.

<br />

| Parameters ||
|---|---|
| `endDateTimeMillis` | `long` <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder` | <br /> |

### setExtras

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public ComplicationData.Builder setExtras (PersistableBundle extras)
```

Sets any extras.


Requires "com.google.wear.permission.SET_COMPLICATION_EXTRAS"

<br />

| Parameters ||
|---|---|
| `extras` | `PersistableBundle` <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder` | <br /> |

### setIcon

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public ComplicationData.Builder setIcon (Icon icon)
```

Sets the icon field for this Complication Data. This is required for the `https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationType#MONOCHROMATIC_IMAGE` type, and is optional for the `https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationType#SHORT_TEXT`, `https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationType#LONG_TEXT`, and `https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationType#RANGED_VALUE` types.

The provided image must be single-color, so that watch faces can tint it as required.

If the icon provided here is not suitable for display in ambient mode with burn-in
protection (e.g. if it includes solid blocks of pixels), then a burn-in safe version of
the icon must be provided via `https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder#setBurnInProtectionIcon(android.graphics.drawable.Icon)`.

Returns this Builder to allow chaining.

<br />

| Parameters ||
|---|---|
| `icon` | `Icon` <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder` | <br /> |

| Throws ||
|---|---|
| `IllegalStateException` | if this field is not valid for the complication type |

### setInvalidatedData

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public ComplicationData.Builder setInvalidatedData (ComplicationData invalidatedData)
```

Sets the invalidated `https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData`, used in `https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationType#NO_DATA` when generated by dynamic value
invalidation.

Returns this Builder to allow chaining.

<br />

| Parameters ||
|---|---|
| `invalidatedData` | `ComplicationData` <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder` | <br /> |

### setLargeImage

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public ComplicationData.Builder setLargeImage (Icon largeImage)
```

Sets the large image field for this Complication Data. This is required for the `https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationType#LARGE_IMAGE` type, and is not valid for any other
type.

The provided image should be suitably sized to fill the screen of the watch.

Returns this Builder to allow chaining.

<br />

| Parameters ||
|---|---|
| `largeImage` | `Icon` <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder` | <br /> |

| Throws ||
|---|---|
| `IllegalStateException` | if this field is not valid for the complication type |

### setLongText

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public ComplicationData.Builder setLongText (ComplicationText longText)
```

Sets long text field. This is required for the `https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationType#LONG_TEXT` type, and is not valid for any other
type.

The value must be provided as a `https://developer.android.com/reference/com/google/wear/services/complications/ComplicationText` object, so that
time-dependent values may be included.

Returns this Builder to allow chaining.

<br />

| Parameters ||
|---|---|
| `longText` | `ComplicationText` <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder` | <br /> |

| Throws ||
|---|---|
| `IllegalStateException` | if this field is not valid for the complication type |

### setLongTitle

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public ComplicationData.Builder setLongTitle (ComplicationText longTitle)
```

Sets the long title field for this Complication Data. This is optional for the `https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationType#LONG_TEXT` type, and is not valid for any other
type.

The value must be provided as a `https://developer.android.com/reference/com/google/wear/services/complications/ComplicationText` object, so that
time-dependent values may be included.

Returns this Builder to allow chaining.

<br />

| Parameters ||
|---|---|
| `longTitle` | `ComplicationText` <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder` | <br /> |

| Throws ||
|---|---|
| `IllegalStateException` | if this field is not valid for the complication type |

### setPersistencePolicy

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public ComplicationData.Builder setPersistencePolicy (int cachePolicy)
```

Sets the complication's persistence policy.

<br />

| Parameters ||
|---|---|
| `cachePolicy` | `int`: Value is either `0` or a combination of the following: - `CACHING_ALLOWED` - `DO_NOT_PERSIST` |

| Returns ||
|---|---|
| `https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder` | <br /> |

### setPlaceholder

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public ComplicationData.Builder setPlaceholder (ComplicationData placeholder)
```

Sets the placeholder.

Returns this Builder to allow chaining.

<br />

| Parameters ||
|---|---|
| `placeholder` | `ComplicationData` <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder` | <br /> |

### setRangedDynamicValue

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public ComplicationData.Builder setRangedDynamicValue (ProtoLayoutDynamicFloat value)
```

Sets a dynamic float value for a ranged Complication Data. It is evaluated to a value
with the same limitations as `https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder#setRangedValue(float)`.

Returns this Builder to allow chaining.

<br />

| Parameters ||
|---|---|
| `value` | `ProtoLayoutDynamicFloat` <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder` | <br /> |

| Throws ||
|---|---|
| `IllegalStateException` | if this field is not valid for the complication type |

### setRangedMaxValue

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public ComplicationData.Builder setRangedMaxValue (float maxValue)
```

Sets the ranged max value field for this Complication Data. This is required for the
`https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationType#RANGED_VALUE` type, and is not valid for
any other type. A `https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationType#RANGED_VALUE` complication visually presents a single value, which is usually a percentage. E.g. you
complication visually presents a single value, which is usually a percentage. E.g. you
have completed 70% of today's target of 10000 steps.

Returns this Builder to allow chaining.

<br />

| Parameters ||
|---|---|
| `maxValue` | `float` <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder` | <br /> |

| Throws ||
|---|---|
| `IllegalStateException` | if this field is not valid for the complication type |

### setRangedMinValue

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public ComplicationData.Builder setRangedMinValue (float minValue)
```

Sets the ranged min value field for this Complication Data. This is required for the
`https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationType#RANGED_VALUE` type, and is not valid for
any other type. A `https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationType#RANGED_VALUE`
complication visually presents a single value, which is usually a percentage. E.g. you
have completed 70% of today's target of 10000 steps.

Returns this Builder to allow chaining.

<br />

| Parameters ||
|---|---|
| `minValue` | `float` <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder` | <br /> |

| Throws ||
|---|---|
| `IllegalStateException` | if this field is not valid for the complication type |

### setRangedValue

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public ComplicationData.Builder setRangedValue (float value)
```

Sets the ranged value field for this Complication Data. This is required for the `https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationType#RANGED_VALUE` type, and the `https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationType#GOAL_PROGRESS` type. For `https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationType#RANGED_VALUE` value must be in the range \[min ..
max} for `https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationType#GOAL_PROGRESS` value must be \>=
and may be greater than target value.

Both the `https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationType#RANGED_VALUE` complication and
the `https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationType#GOAL_PROGRESS` complication visually
present a single value, which is usually a percentage. E.g. you have completed 70% of
today's target of 10000 steps.

Returns this Builder to allow chaining.

<br />

| Parameters ||
|---|---|
| `value` | `float` <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder` | <br /> |

| Throws ||
|---|---|
| `IllegalStateException` | if this field is not valid for the complication type |

### setRangedValueType

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public ComplicationData.Builder setRangedValueType (int valueType)
```

Sets the ranged value type field which provides meta data about the value. This is
optional for the `https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationType#RANGED_VALUE` type.

<br />

| Parameters ||
|---|---|
| `valueType` | `int` <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder` | <br /> |

### setShortText

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public ComplicationData.Builder setShortText (ComplicationText shortText)
```

Sets the short text field. This is required for the `https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationType#SHORT_TEXT` type, is optional for the `https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationType#RANGED_VALUE` and `https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationType#NO_PERMISSION` types, and is not valid for any
other type.

The value must be provided as a `https://developer.android.com/reference/com/google/wear/services/complications/ComplicationText` object, so that
time-dependent values may be included.

The length of the text, including any time-dependent values, should not exceed seven
characters. If it does, the text may be truncated by the watch face or might not fit in
the complication.

Returns this Builder to allow chaining.

<br />

| Parameters ||
|---|---|
| `shortText` | `ComplicationText` <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder` | <br /> |

| Throws ||
|---|---|
| `IllegalStateException` | if this field is not valid for the complication type |

### setShortTitle

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public ComplicationData.Builder setShortTitle (ComplicationText shortTitle)
```

Sets the short title field. This is valid for the `https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationType#SHORT_TEXT`, `https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationType#RANGED_VALUE`, and `https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationType#NO_PERMISSION` types, and is not valid for any
other type.

The value must be provided as a `https://developer.android.com/reference/com/google/wear/services/complications/ComplicationText` object, so that
time-dependent values may be included.

The length of the text, including any time-dependent values, should not exceed seven
characters. If it does, the text may be truncated by the watch face or might not fit in
the complication.

Returns this Builder to allow chaining.

<br />

| Parameters ||
|---|---|
| `shortTitle` | `ComplicationText` <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder` | <br /> |

| Throws ||
|---|---|
| `IllegalStateException` | if this field is not valid for the complication type |

### setSmallImage

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public ComplicationData.Builder setSmallImage (Icon smallImage)
```

Sets the small image field for this Complication Data. This is required for the `https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationType#SMALL_IMAGE` type, and is optional for the `https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationType#LONG_TEXT` type.

Returns this Builder to allow chaining.

<br />

| Parameters ||
|---|---|
| `smallImage` | `Icon` <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder` | <br /> |

| Throws ||
|---|---|
| `IllegalStateException` | if this field is not valid for the complication type |

### setSmallImageStyle

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public ComplicationData.Builder setSmallImageStyle (int imageStyle)
```

Sets the display style for this complication data. This is valid only for types that
contain small images, i.e. `https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationType#SMALL_IMAGE` and `https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationType#LONG_TEXT`.

This affects how watch faces will draw the image in the complication.

If not specified, the default is `https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData#IMAGE_STYLE_PHOTO`.

<br />

| Parameters ||
|---|---|
| `imageStyle` | `int`: Value is one of the following: - `https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData#IMAGE_STYLE_PHOTO` - `https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData#IMAGE_STYLE_ICON` |

| Returns ||
|---|---|
| `https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder` | <br /> |

| Throws ||
|---|---|
| `IllegalStateException` | if this field is not valid for the complication type |

**See also:**

- `https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData#IMAGE_STYLE_PHOTO`
- `https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData#IMAGE_STYLE_ICON`

### setStartDateTimeMillis

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public ComplicationData.Builder setStartDateTimeMillis (long startDateTimeMillis)
```

Sets the start time for this complication data. This is optional for any type.

The complication data will be considered inactive (i.e. should not be displayed) if
the current time is less than the start time. If not specified, the data is considered
active for all time up to the end time (or always active if end time is also not
specified).

Any non-positive values of `startDateTimeMillis` will leave this field unset.

Returns this Builder to allow chaining.

<br />

| Parameters ||
|---|---|
| `startDateTimeMillis` | `long` <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder` | <br /> |

### setTapAction

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public ComplicationData.Builder setTapAction (PendingIntent pendingIntent)
```

Sets the tap action field for this Complication Data. This is optional for any non-empty
type.

The provided `https://developer.android.com/reference/android/app/PendingIntent` may be fired if the complication is tapped on. Note
that some complications might not be tappable, in which case this field will be ignored.

Returns this Builder to allow chaining.

<br />

| Parameters ||
|---|---|
| `pendingIntent` | `PendingIntent` <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder` | <br /> |

### setTapActionLostDueToSerialization

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public ComplicationData.Builder setTapActionLostDueToSerialization (boolean tapActionLostDueToSerialization)
```

Sets whether or not this ComplicationData has been serialized.

Returns this Builder to allow chaining.

<br />

| Parameters ||
|---|---|
| `tapActionLostDueToSerialization` | `boolean` <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder` | <br /> |

### setTargetValue

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public ComplicationData.Builder setTargetValue (float targetValue)
```

Sets the ranged target value field for this Complication Data. This is required for the
`https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationType#GOAL_PROGRESS` type, and is not valid for
any other type. A `https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationType#GOAL_PROGRESS`
complication visually presents a single value, which is usually a percentage. E.g. you
have completed 70% of today's target of 10000 steps.

Returns this Builder to allow chaining.

<br />

| Parameters ||
|---|---|
| `targetValue` | `float` <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder` | <br /> |

| Throws ||
|---|---|
| `IllegalStateException` | if this field is not valid for the complication type |

### setTimelineEndEpochSecond

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public ComplicationData.Builder setTimelineEndEpochSecond (long epochSecond)
```

For timeline entries. Sets the epoch second at which this timeline entry becomes invalid.

Returns this Builder to allow chaining.

<br />

| Parameters ||
|---|---|
| `epochSecond` | `long` <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder` | <br /> |

### setTimelineEntries

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public ComplicationData.Builder setTimelineEntries (Collection<ComplicationData> timelineEntries)
```

Sets the list of `https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData` timeline entries.

Returns this Builder to allow chaining.

<br />

| Parameters ||
|---|---|
| `timelineEntries` | `Collection` <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder` | <br /> |

### setTimelineStartEpochSecond

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public ComplicationData.Builder setTimelineStartEpochSecond (long epochSecond)
```

For timeline entries. Sets the epoch second at which this timeline entry becomes valid.

Returns this Builder to allow chaining.

<br />

| Parameters ||
|---|---|
| `epochSecond` | `long` <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/com/google/wear/services/complications/ComplicationData.Builder` | <br /> |