Note: As of July 10, 2024, watch faces must use the Watch Face Format in order to be installed on new watches that launch with Wear OS 5 pre-installed. Learn more about the user-facing changes in this Help Center article.

Additionally, starting in early 2025 (specific date to be announced during Q4 2024), all new watch faces published on Google Play must use the Watch Face Format.

public interface ComplicationText


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 but also a way to know whether the text needs to be re-rendered, by means of returnsSameText, getNextChangeTime, and isAlwaysEmpty.

Summary

Public fields

default static final @NonNull ComplicationText
default static final @NonNull ComplicationText

For use when the real data isn't available yet, this ComplicationText should be rendered as a placeholder.

Public methods

abstract @NonNull Instant

Returns the next time after afterInstant at which the text may change.

abstract @NonNull CharSequence
getTextAt(@NonNull Resources resources, @NonNull Instant instant)

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

abstract boolean
abstract boolean
returnsSameText(
    @NonNull Instant firstInstant,
    @NonNull Instant secondInstant
)

Returns true if the result of getTextAt will be the same for both firstInstant and secondInstant.

Public fields

EMPTY

default static final @NonNull ComplicationText EMPTY

PLACEHOLDER

default static final @NonNull ComplicationText PLACEHOLDER

For use when the real data isn't available yet, this 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.

Public methods

getNextChangeTime

Added in 1.0.0
abstract @NonNull Instant getNextChangeTime(@NonNull Instant afterInstant)

Returns the next time after afterInstant at which the text may change.

getTextAt

Added in 1.0.0
abstract @NonNull CharSequence getTextAt(@NonNull Resources resources, @NonNull Instant instant)

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

Parameters
@NonNull Resources resources

Resources from the current context

@NonNull Instant instant

The Instant at which to sample the text

isAlwaysEmpty

Added in 1.0.0
abstract boolean isAlwaysEmpty()

returnsSameText

Added in 1.0.0
abstract boolean returnsSameText(
    @NonNull Instant firstInstant,
    @NonNull Instant secondInstant
)

Returns true if the result of getTextAt will be the same for both firstInstant and secondInstant.