# ShortTextComplicationData

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.ShortTextComplicationData) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.0.0)

*** ** * ** ***

<br />

```
public final class ShortTextComplicationData 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.ShortTextComplicationData](https://developer.android.com/reference/androidx/wear/watchface/complications/data/ShortTextComplicationData) |

*** ** * ** ***

Type used for complications where the primary piece of data is a short piece of text (expected to be no more than seven characters in length). The text may be accompanied by an icon or a title or both.

If only one of icon and title is provided, it is expected that it will be displayed. If both are provided, it is expected that at least one of these will be displayed.

If a `https://developer.android.com/reference/androidx/wear/watchface/complications/data/ShortTextComplicationData#monochromaticImage()` and a `https://developer.android.com/reference/androidx/wear/watchface/complications/data/ShortTextComplicationData#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/ShortTextComplicationData#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/ShortTextComplicationData#smallImage()`. It's best practice for a ComplicationDataSource to specify both a `https://developer.android.com/reference/androidx/wear/watchface/complications/data/ShortTextComplicationData#monochromaticImage()` and a `https://developer.android.com/reference/androidx/wear/watchface/complications/data/ShortTextComplicationData#smallImage()`

A data source that wants to serve a ShortTextComplicationData 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="SHORT_TEXT"/>
```

## Summary

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

| ### Public fields |
|---|---|
| `static final int` | `https://developer.android.com/reference/androidx/wear/watchface/complications/data/ShortTextComplicationData#MAX_TEXT_LENGTH()` The maximum length of `https://developer.android.com/reference/androidx/wear/watchface/complications/data/ShortTextComplicationData#text()` in characters. |
| `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/ShortTextComplicationData#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/ComplicationText` | `https://developer.android.com/reference/androidx/wear/watchface/complications/data/ShortTextComplicationData#getContentDescription()()` The content description field for accessibility. |
| `final https://developer.android.com/reference/androidx/wear/watchface/complications/data/MonochromaticImage` | `https://developer.android.com/reference/androidx/wear/watchface/complications/data/ShortTextComplicationData#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/ShortTextComplicationData#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/ShortTextComplicationData#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/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationText` | `https://developer.android.com/reference/androidx/wear/watchface/complications/data/ShortTextComplicationData#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/ShortTextComplicationData#getTitle()()` The optional title `https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationText`. |
| `boolean` | `https://developer.android.com/reference/androidx/wear/watchface/complications/data/ShortTextComplicationData#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/ShortTextComplicationData#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.

## Public fields

### MAX_TEXT_LENGTH

```
public static final int MAX_TEXT_LENGTH
```

The maximum length of `https://developer.android.com/reference/androidx/wear/watchface/complications/data/ShortTextComplicationData#text()` in characters.

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

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

### 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 @NonNull 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 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 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.

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