# TimeDifferenceComplicationText

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

*** ** * ** ***


```
public final class TimeDifferenceComplicationText implements ComplicationText
```

<br />

*** ** * ** ***

A `https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationText` that represents a time difference.

## Summary

| ### Nested types |
|---|
| `public final class https://developer.android.com/reference/androidx/wear/watchface/complications/data/TimeDifferenceComplicationText.Builder` Builder for `https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationText` representing a time difference. |

| ### Public methods |
|---|---|
| `boolean` | `https://developer.android.com/reference/androidx/wear/watchface/complications/data/TimeDifferenceComplicationText#equals(kotlin.Any)(https://developer.android.com/reference/java/lang/Object.html other)` |
| `final https://developer.android.com/reference/java/util/concurrent/TimeUnit.html` | `https://developer.android.com/reference/androidx/wear/watchface/complications/data/TimeDifferenceComplicationText#getMinimumTimeUnit()()` Gets the smallest unit that may be shown in the time difference text. |
| `@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/TimeDifferenceComplicationText#getNextChangeTime(java.time.Instant)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/time/Instant.html afterInstant)` Returns the next time after `https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationText#getNextChangeTime(java.time.Instant)` at which the text may change. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/CharSequence.html` | `https://developer.android.com/reference/androidx/wear/watchface/complications/data/TimeDifferenceComplicationText#getTextAt(android.content.res.Resources,java.time.Instant)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/content/res/Resources.html resources, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/time/Instant.html instant)` Returns the text that should be displayed for the given timestamp. |
| `int` | `https://developer.android.com/reference/androidx/wear/watchface/complications/data/TimeDifferenceComplicationText#hashCode()()` |
| `boolean` | `https://developer.android.com/reference/androidx/wear/watchface/complications/data/TimeDifferenceComplicationText#isAlwaysEmpty()()` |
| `boolean` | `https://developer.android.com/reference/androidx/wear/watchface/complications/data/TimeDifferenceComplicationText#returnsSameText(java.time.Instant,java.time.Instant)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/time/Instant.html firstInstant, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/time/Instant.html secondInstant )` Returns true if the result of `https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationText#getTextAt(android.content.res.Resources,java.time.Instant)` will be the same for both `https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationText#returnsSameText(java.time.Instant,java.time.Instant)` and `https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationText#returnsSameText(java.time.Instant,java.time.Instant)`. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/wear/watchface/complications/data/TimeDifferenceComplicationText#toString()()` |

## Public methods

### equals

```
public boolean equals(Object other)
```

### getMinimumTimeUnit

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

```
public final TimeUnit getMinimumTimeUnit()
```

Gets the smallest unit that may be shown in the time difference text. If specified, units smaller than this minimum will not be included.

### getNextChangeTime

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

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

### getTextAt

```
public @NonNull CharSequence getTextAt(@NonNull Resources resources, @NonNull Instant instant)
```

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

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull 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 |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/time/Instant.html instant` | The `https://developer.android.com/reference/java/time/Instant.html` at which to sample the text |

### hashCode

```
public int hashCode()
```

### isAlwaysEmpty

```
public boolean isAlwaysEmpty()
```

### returnsSameText

```
public boolean returnsSameText(
    @NonNull Instant firstInstant,
    @NonNull Instant secondInstant
)
```

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

### toString

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