# ComplicationText

# ComplicationText

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/Text.kt+class:androidx.wear.watchface.complications.data.ComplicationText)  
Added in[1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.0.0)

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationText "View this page in Java")

<br />

```
interface ComplicationText
```

<br />

Known direct subclasses  
[DynamicComplicationText](https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/DynamicComplicationText),[PlainComplicationText](https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/PlainComplicationText),[TimeDifferenceComplicationText](https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/TimeDifferenceComplicationText),[TimeFormatComplicationText](https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/TimeFormatComplicationText)  

|------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [DynamicComplicationText](https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/DynamicComplicationText)               | A[ComplicationText](https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/ComplicationText)where the system evaluates a[DynamicString](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicString). |
| [PlainComplicationText](https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/PlainComplicationText)                   | A[ComplicationText](https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/ComplicationText)that contains plain text.                                                                                                                                       |
| [TimeDifferenceComplicationText](https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/TimeDifferenceComplicationText) | A[ComplicationText](https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/ComplicationText)that represents a time difference.                                                                                                                              |
| [TimeFormatComplicationText](https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/TimeFormatComplicationText)         | A[ComplicationText](https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/ComplicationText)that shows a formatted time.                                                                                                                                    |

*** ** * ** ***

The text within a complication.

This text may change over time and this interface provides both a way to determine the current text to show with[getTextAt](https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/ComplicationText#getTextAt(android.content.res.Resources,java.time.Instant))but also a way to know whether the text needs to be re-rendered, by means of[returnsSameText](https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/ComplicationText#returnsSameText(java.time.Instant,java.time.Instant)),[getNextChangeTime](https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/ComplicationText#getNextChangeTime(java.time.Instant)), and[isAlwaysEmpty](https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/ComplicationText#isAlwaysEmpty()).

## Summary

|                                                ### Public companion properties                                                 |
|--------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [ComplicationText](https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/ComplicationText) | [EMPTY](https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/ComplicationText#EMPTY())                                                                                                                                                                                                                                    |
| [ComplicationText](https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/ComplicationText) | [PLACEHOLDER](https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/ComplicationText#PLACEHOLDER()) For use when the real data isn't available yet, this[ComplicationText](https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/ComplicationText)should be rendered as a placeholder. |

|                                      ### Public functions                                      |
|------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Instant](https://developer.android.com/reference/java/time/Instant.html)                      | [getNextChangeTime](https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/ComplicationText#getNextChangeTime(java.time.Instant))`(afterInstant: `[Instant](https://developer.android.com/reference/java/time/Instant.html)`)` Returns the next time after[afterInstant](https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/ComplicationText#getNextChangeTime(java.time.Instant))at which the text may change.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| [CharSequence](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html) | [getTextAt](https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/ComplicationText#getTextAt(android.content.res.Resources,java.time.Instant))`(resources: `[Resources](https://developer.android.com/reference/android/content/res/Resources.html)`, instant: `[Instant](https://developer.android.com/reference/java/time/Instant.html)`)` Returns the text that should be displayed for the given timestamp.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)            | [isAlwaysEmpty](https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/ComplicationText#isAlwaysEmpty())`()`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)            | [returnsSameText](https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/ComplicationText#returnsSameText(java.time.Instant,java.time.Instant))`(firstInstant: `[Instant](https://developer.android.com/reference/java/time/Instant.html)`, secondInstant: `[Instant](https://developer.android.com/reference/java/time/Instant.html)`)` Returns true if the result of[getTextAt](https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/ComplicationText#getTextAt(android.content.res.Resources,java.time.Instant))will be the same for both[firstInstant](https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/ComplicationText#returnsSameText(java.time.Instant,java.time.Instant))and[secondInstant](https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/ComplicationText#returnsSameText(java.time.Instant,java.time.Instant)). |

## Public companion properties

### EMPTY

```
val EMPTY: ComplicationText
```  

### PLACEHOLDER

```
val PLACEHOLDER: ComplicationText
```

For use when the real data isn't available yet, this[ComplicationText](https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/ComplicationText)should be rendered as a placeholder. It is suggested that it should be rendered with a light grey box.

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

## Public functions

### getNextChangeTime

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

```
fun getNextChangeTime(afterInstant: Instant): Instant
```

Returns the next time after[afterInstant](https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/ComplicationText#getNextChangeTime(java.time.Instant))at which the text may change.  

### getTextAt

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

```
fun getTextAt(resources: Resources, instant: Instant): CharSequence
```

Returns the text that should be displayed for the given timestamp.  

|                                              Parameters                                              |
|------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------|
| `resources: `[Resources](https://developer.android.com/reference/android/content/res/Resources.html) | [Resources](https://developer.android.com/reference/android/content/res/Resources.html)from the current context |
| `instant: `[Instant](https://developer.android.com/reference/java/time/Instant.html)                 | The[Instant](https://developer.android.com/reference/java/time/Instant.html)at which to sample the text         |

### isAlwaysEmpty

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

```
fun isAlwaysEmpty(): Boolean
```  

### returnsSameText

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

```
fun returnsSameText(firstInstant: Instant, secondInstant: Instant): Boolean
```

Returns true if the result of[getTextAt](https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/ComplicationText#getTextAt(android.content.res.Resources,java.time.Instant))will be the same for both[firstInstant](https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/ComplicationText#returnsSameText(java.time.Instant,java.time.Instant))and[secondInstant](https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/ComplicationText#returnsSameText(java.time.Instant,java.time.Instant)).