# RangedValueComplicationData

Artifact: [androidx.wear.watchface:watchface-complications-data](https://developer.android.com/jetpack/androidx/releases/wear-watchface) [View Source](https://cs.android.com/search?q=file:androidx/wear/watchface/complications/data/Data.kt+class:androidx.wear.watchface.complications.data.RangedValueComplicationData) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.0.0)

*** ** * ** ***

<br />

```
public final class RangedValueComplicationData extends ComplicationData
```

<br />

|---|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object.html) |||
| ↳ | [androidx.wear.watchface.complications.data.ComplicationData](https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationData) ||
|   | ↳ | [androidx.wear.watchface.complications.data.RangedValueComplicationData](https://developer.android.com/reference/androidx/wear/watchface/complications/data/RangedValueComplicationData) |

*** ** * ** ***

Type used for complications including a numerical value within a range, such as a percentage. The value may be accompanied by an icon and/or short text and title.

The `https://developer.android.com/reference/androidx/wear/watchface/complications/data/RangedValueComplicationData#min()` and `https://developer.android.com/reference/androidx/wear/watchface/complications/data/RangedValueComplicationData#max()` fields are required for this type, as well as one of `https://developer.android.com/reference/androidx/wear/watchface/complications/data/RangedValueComplicationData#value()` or `https://developer.android.com/reference/androidx/wear/watchface/complications/data/RangedValueComplicationData#dynamicValue()`. The value within the range is expected to always be displayed.

The icon, title, and text fields are optional and the watch face may choose which of these fields to display, if any.

If a `https://developer.android.com/reference/androidx/wear/watchface/complications/data/RangedValueComplicationData#monochromaticImage()` and a `https://developer.android.com/reference/androidx/wear/watchface/complications/data/RangedValueComplicationData#smallImage()` are both specified then only one should be displayed. If the complication is drawn with a single color it's recommended to choose `https://developer.android.com/reference/androidx/wear/watchface/complications/data/RangedValueComplicationData#monochromaticImage()` and apply a tint. If the complication is rendered with multiple colors it's recommended to choose the `https://developer.android.com/reference/androidx/wear/watchface/complications/data/RangedValueComplicationData#smallImage()`. It's best practice for a ComplicationDataSource to specify both a `https://developer.android.com/reference/androidx/wear/watchface/complications/data/RangedValueComplicationData#monochromaticImage()` and a `https://developer.android.com/reference/androidx/wear/watchface/complications/data/RangedValueComplicationData#smallImage()`.

A data source that wants to serve a RangedValueComplicationData must include the following meta data in its manifest (NB the value is a comma separated list):

```
<meta-data android:name="android.support.wearable.complications.SUPPORTED_TYPES"
   android:value="RANGED_VALUE"/>
```

## Summary

| ### Nested types |
|---|
| `public final class https://developer.android.com/reference/androidx/wear/watchface/complications/data/RangedValueComplicationData.Builder` Builder for `https://developer.android.com/reference/androidx/wear/watchface/complications/data/RangedValueComplicationData`. |

| ### Constants |
|---|---|
| `static final int` | `https://developer.android.com/reference/androidx/wear/watchface/complications/data/RangedValueComplicationData#TYPE_PERCENTAGE() = 2` The ranged value represents a percentage in the range 0..100. |
| `static final int` | `https://developer.android.com/reference/androidx/wear/watchface/complications/data/RangedValueComplicationData#TYPE_RATING() = 1` The ranged value represents a rating or score for something unrelated to the user, e.g. the air quality index or the UV index. |
| `static final int` | `https://developer.android.com/reference/androidx/wear/watchface/complications/data/RangedValueComplicationData#TYPE_UNDEFINED() = 0` The ranged value's semantic hasn't been explicitly defined, most commonly it's a percentage however. |

| ### Public fields |
|---|---|
| `static final float` | `https://developer.android.com/reference/androidx/wear/watchface/complications/data/RangedValueComplicationData#PLACEHOLDER()` Used to signal the range should be rendered as a placeholder. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationType` | `https://developer.android.com/reference/androidx/wear/watchface/complications/data/RangedValueComplicationData#TYPE()` The `https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationType` corresponding to objects of this type. |

| ### Public methods |
|---|---|
| `final https://developer.android.com/reference/androidx/wear/watchface/complications/data/ColorRamp` | `https://developer.android.com/reference/androidx/wear/watchface/complications/data/RangedValueComplicationData#getColorRamp()()` Optional hint to render the value with the specified `https://developer.android.com/reference/androidx/wear/watchface/complications/data/ColorRamp`. |
| `final https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationText` | `https://developer.android.com/reference/androidx/wear/watchface/complications/data/RangedValueComplicationData#getContentDescription()()` The content description field for accessibility. |
| `final https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicBuilders.DynamicFloat` | `@https://developer.android.com/reference/androidx/annotation/RequiresApi(value = 33) https://developer.android.com/reference/androidx/wear/watchface/complications/data/RangedValueComplicationData#getDynamicValue()()` The `https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicBuilders.DynamicFloat` optionally set by the data source. |
| `final float` | `https://developer.android.com/reference/androidx/wear/watchface/complications/data/RangedValueComplicationData#getMax()()` The maximum `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` value for this complication. |
| `final float` | `https://developer.android.com/reference/androidx/wear/watchface/complications/data/RangedValueComplicationData#getMin()()` The minimum `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` value for this complication. |
| `final https://developer.android.com/reference/androidx/wear/watchface/complications/data/MonochromaticImage` | `https://developer.android.com/reference/androidx/wear/watchface/complications/data/RangedValueComplicationData#getMonochromaticImage()()` A simple `https://developer.android.com/reference/androidx/wear/watchface/complications/data/MonochromaticImage` image that can be tinted by the watch face. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/time/Instant.html` | `https://developer.android.com/reference/androidx/wear/watchface/complications/data/RangedValueComplicationData#getNextChangeInstant(java.time.Instant)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/time/Instant.html afterInstant)` Returns the next `https://developer.android.com/reference/java/time/Instant.html` after `https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationData#getNextChangeInstant(java.time.Instant)` at which any field of the complication may change. |
| `final https://developer.android.com/reference/androidx/wear/watchface/complications/data/SmallImage` | `https://developer.android.com/reference/androidx/wear/watchface/complications/data/RangedValueComplicationData#getSmallImage()()` A `https://developer.android.com/reference/androidx/wear/watchface/complications/data/SmallImage` that is expected to cover a small fraction of a watch face occupied by a single complication. |
| `final https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationText` | `https://developer.android.com/reference/androidx/wear/watchface/complications/data/RangedValueComplicationData#getText()()` The body `https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationText` of the complication. |
| `final https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationText` | `https://developer.android.com/reference/androidx/wear/watchface/complications/data/RangedValueComplicationData#getTitle()()` The optional title `https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationText`. |
| `final float` | `https://developer.android.com/reference/androidx/wear/watchface/complications/data/RangedValueComplicationData#getValue()()` The `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` value of this complication which is \>= `https://developer.android.com/reference/androidx/wear/watchface/complications/data/RangedValueComplicationData#min()` and \<= `https://developer.android.com/reference/androidx/wear/watchface/complications/data/RangedValueComplicationData#max()` or equal to `https://developer.android.com/reference/androidx/wear/watchface/complications/data/RangedValueComplicationData#PLACEHOLDER()`. |
| `final int` | `https://developer.android.com/reference/androidx/wear/watchface/complications/data/RangedValueComplicationData#getValueType()()` The semantic meaning of `https://developer.android.com/reference/androidx/wear/watchface/complications/data/RangedValueComplicationData#value()`. |
| `boolean` | `https://developer.android.com/reference/androidx/wear/watchface/complications/data/RangedValueComplicationData#hasPlaceholderFields()()` Returns `true` if any of the fields of this ComplicationData are placeholders. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/wear/watchface/complications/data/RangedValueComplicationData#toString()()` |

### Inherited methods

From [androidx.wear.watchface.complications.data.ComplicationData](https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationData) `boolean` `https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationData#equals(kotlin.Any)(https://developer.android.com/reference/java/lang/Object.html other)` `final https://developer.android.com/reference/android/content/ComponentName.html` `https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationData#getDataSource()()`

The `https://developer.android.com/reference/android/content/ComponentName.html` of the `https://developer.android.com/reference/androidx/wear/watchface/complications/datasource/ComplicationDataSourceService` that provided the ComplicationData.
`final int` `https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationData#getDisplayPolicy()()`

The `https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationDisplayPolicies` for this complication.
`final https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationData` `https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationData#getDynamicValueInvalidationFallback()()`

Used in case any dynamic value has been invalidated.
`final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/os/PersistableBundle.html` `https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationData#getExtras()()`

A copy of any extras set by a complication provider with the privileged permission `com.google.wear.permission.SET_COMPLICATION_EXTRAS` or `https://developer.android.com/reference/android/os/PersistableBundle.html#EMPTY`.
`final int` `https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationData#getPersistencePolicy()()`

The `https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationPersistencePolicies` for this complication.
`final https://developer.android.com/reference/android/app/PendingIntent.html` `https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationData#getTapAction()()`

The `https://developer.android.com/reference/android/app/PendingIntent.html` to send when the complication is tapped on.
`final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationType` `https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationData#getType()()`

The `https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationType` of this complication data.
`final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/complications/data/TimeRange` `https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationData#getValidTimeRange()()`

The `https://developer.android.com/reference/androidx/wear/watchface/complications/data/TimeRange` within which the complication should be displayed.
`int` `https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationData#hashCode()()` `final boolean` `https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationData#isTapActionLostDueToSerialization()()`

`https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationData#tapAction()` which is a `https://developer.android.com/reference/android/app/PendingIntent.html` unfortunately can't be serialized.
`final void` `https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationData#setTapActionLostDueToSerialization(kotlin.Boolean)(boolean value)`

`https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationData#tapAction()` which is a `https://developer.android.com/reference/android/app/PendingIntent.html` unfortunately can't be serialized.

## Constants

### TYPE_PERCENTAGE

```
public static final int TYPE_PERCENTAGE = 2
```

The ranged value represents a percentage in the range 0..100. E.g. Battery charge.

### TYPE_RATING

```
public static final int TYPE_RATING = 1
```

The ranged value represents a rating or score for something unrelated to the user, e.g. the air quality index or the UV index.

### TYPE_UNDEFINED

```
public static final int TYPE_UNDEFINED = 0
```

The ranged value's semantic hasn't been explicitly defined, most commonly it's a percentage however.

## Public fields

### PLACEHOLDER

```
public static final float PLACEHOLDER
```

Used to signal the range should be rendered as a placeholder. It's suggested that a placeholder ranged value be drawn as a grey arc with a percentage value selected by the renderer.

Note a placeholder may only be used in the context of `https://developer.android.com/reference/androidx/wear/watchface/complications/data/NoDataComplicationData#placeholder()`.

### TYPE

```
public static final @NonNull ComplicationType TYPE
```

The `https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationType` corresponding to objects of this type.

## Public methods

### getColorRamp

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

```
public final ColorRamp getColorRamp()
```

Optional hint to render the value with the specified `https://developer.android.com/reference/androidx/wear/watchface/complications/data/ColorRamp`. When present the renderer may choose to use the ColorRamp when rendering the progress bar.

### getContentDescription

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

```
public final ComplicationText getContentDescription()
```

The content description field for accessibility.

### getDynamicValue

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

```
@RequiresApi(value = 33)
public final DynamicBuilders.DynamicFloat getDynamicValue()
```

The `https://developer.android.com/reference/androidx/wear/protolayout/expression/DynamicBuilders.DynamicFloat` optionally set by the data source. If present the system will dynamically evaluate this and store the result in `https://developer.android.com/reference/androidx/wear/watchface/complications/data/RangedValueComplicationData#value()`. Watch faces can typically ignore this field.

### getMax

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

```
public final float getMax()
```

The maximum `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` value for this complication.

### getMin

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

```
public final float getMin()
```

The minimum `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` value for this complication.

### getMonochromaticImage

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

```
public final MonochromaticImage getMonochromaticImage()
```

A simple `https://developer.android.com/reference/androidx/wear/watchface/complications/data/MonochromaticImage` image that can be tinted by the watch face. If the monochromaticImage is equal to `https://developer.android.com/reference/androidx/wear/watchface/complications/data/MonochromaticImage#PLACEHOLDER()` the renderer must treat it as a placeholder rather than rendering normally, its suggested it should be rendered as a light grey box.

### getNextChangeInstant

```
public @NonNull Instant getNextChangeInstant(@NonNull Instant afterInstant)
```

Returns the next `https://developer.android.com/reference/java/time/Instant.html` after `https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationData#getNextChangeInstant(java.time.Instant)` at which any field of the complication may change. If there's no scheduled changes then `https://developer.android.com/reference/java/time/Instant.html#MAX` will be returned.

See `https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationText#getNextChangeTime(java.time.Instant)`

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/time/Instant.html afterInstant` | The reference `https://developer.android.com/reference/java/time/Instant.html`, after which changes will be reported. |

### getSmallImage

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

```
public final SmallImage getSmallImage()
```

A `https://developer.android.com/reference/androidx/wear/watchface/complications/data/SmallImage` that is expected to cover a small fraction of a watch face occupied by a single complication. If the smallImage is equal to `https://developer.android.com/reference/androidx/wear/watchface/complications/data/SmallImage#PLACEHOLDER()` the renderer must treat it as a placeholder rather than rendering normally, its suggested it should be rendered as a light grey box.

### getText

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

```
public final ComplicationText getText()
```

The body `https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationText` of the complication. The length of the text, including any time-dependent values at any valid time, is expected to not exceed seven characters. When using this text, the watch face should be able to display any string of up to seven characters (reducing the text size appropriately if the string is very wide). Although not expected, it is possible that strings of more than seven characters might be seen, in which case they may be truncated. If the text is equal to `https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationText#PLACEHOLDER()` the renderer must treat it as a placeholder rather than rendering normally, its suggested it should be rendered as a light grey box.

### getTitle

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

```
public final ComplicationText getTitle()
```

The optional title `https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationText`. The length of the title, including any time-dependent values at any valid time, is expected to not exceed seven characters. When using this text, the watch face should be able to display any string of up to seven characters (reducing the text size appropriately if the string is very wide). Although not expected, it is possible that strings of more than seven characters might be seen, in which case they may be truncated. If the title is equal to `https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationText#PLACEHOLDER()` the renderer must treat it as a placeholder rather than rendering normally, its suggested it should be rendered as a light grey box.

### getValue

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

```
public final float getValue()
```

The `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` value of this complication which is \>= `https://developer.android.com/reference/androidx/wear/watchface/complications/data/RangedValueComplicationData#min()` and \<= `https://developer.android.com/reference/androidx/wear/watchface/complications/data/RangedValueComplicationData#max()` or equal to `https://developer.android.com/reference/androidx/wear/watchface/complications/data/RangedValueComplicationData#PLACEHOLDER()`. If it's equal to `https://developer.android.com/reference/androidx/wear/watchface/complications/data/RangedValueComplicationData#PLACEHOLDER()` the renderer must treat it as a placeholder rather than rendering normally, its suggested to be drawn as a grey arc with a percentage value selected by the renderer. The semantic meaning of value is described by `https://developer.android.com/reference/androidx/wear/watchface/complications/data/RangedValueComplicationData#valueType()`.

### getValueType

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

```
public final int getValueType()
```

The semantic meaning of `https://developer.android.com/reference/androidx/wear/watchface/complications/data/RangedValueComplicationData#value()`. The complication renderer may choose to visually differentiate between the different types, for example rendering a dot on a line/arc to indicate the value for a `https://developer.android.com/reference/androidx/wear/watchface/complications/data/RangedValueComplicationData#TYPE_RATING()`.

### hasPlaceholderFields

```
public boolean hasPlaceholderFields()
```

Returns `true` if any of the fields of this ComplicationData are placeholders. I.e. if any fields are equal to: `https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationText#PLACEHOLDER()`, `https://developer.android.com/reference/androidx/wear/watchface/complications/data/SmallImage#PLACEHOLDER()`, `https://developer.android.com/reference/androidx/wear/watchface/complications/data/MonochromaticImage#PLACEHOLDER()`, `https://developer.android.com/reference/androidx/wear/watchface/complications/data/PhotoImageComplicationData#PLACEHOLDER()`, or `https://developer.android.com/reference/androidx/wear/watchface/complications/data/RangedValueComplicationData#PLACEHOLDER()`.

### toString

```
public @NonNull String toString()
```