# TimeDependentText

# TimeDependentText

Artifact:[androidx.wear:wear-ongoing](https://developer.android.com/jetpack/androidx/releases/wear)  
[View Source](https://cs.android.com/search?q=file:androidx/wear/ongoing/TimeDependentText.java+class:androidx.wear.ongoing.TimeDependentText)  
Added in[1.0.0](https://developer.android.com/jetpack/androidx/releases/wear#1.0.0)

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/wear/ongoing/TimeDependentText "View this page in Java")

<br />

```
interface TimeDependentText
```

<br />

Known direct subclasses  
[Status.Part](https://developer.android.com/reference/kotlin/androidx/wear/ongoing/Status.Part),[Status](https://developer.android.com/reference/kotlin/androidx/wear/ongoing/Status)  

|-------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------|
| [Status.Part](https://developer.android.com/reference/kotlin/androidx/wear/ongoing/Status.Part) | Abstract class to represent An Ongoing activity status or part of it.    |
| [Status](https://developer.android.com/reference/kotlin/androidx/wear/ongoing/Status)           | Base class to represent the status of an Ongoing Activity and render it. |

Known indirect subclasses  
[Status.StopwatchPart](https://developer.android.com/reference/kotlin/androidx/wear/ongoing/Status.StopwatchPart),[Status.TextPart](https://developer.android.com/reference/kotlin/androidx/wear/ongoing/Status.TextPart),[Status.TimerOrStopwatchPart](https://developer.android.com/reference/kotlin/androidx/wear/ongoing/Status.TimerOrStopwatchPart),[Status.TimerPart](https://developer.android.com/reference/kotlin/androidx/wear/ongoing/Status.TimerPart)  

|---------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Status.StopwatchPart](https://developer.android.com/reference/kotlin/androidx/wear/ongoing/Status.StopwatchPart)               | An Ongoing activity status (or part of it) representing a stopwatch                                                                                                                                                                                                                                            |
| [Status.TextPart](https://developer.android.com/reference/kotlin/androidx/wear/ongoing/Status.TextPart)                         | An Ongoing activity status (or part of it) representing a plain, static text.                                                                                                                                                                                                                                  |
| [Status.TimerOrStopwatchPart](https://developer.android.com/reference/kotlin/androidx/wear/ongoing/Status.TimerOrStopwatchPart) | Base class for[TimerPart](https://developer.android.com/reference/kotlin/androidx/wear/ongoing/Status.TimerPart)and[StopwatchPart](https://developer.android.com/reference/kotlin/androidx/wear/ongoing/Status.StopwatchPart), defines the getters but can't be created directly, create one of those instead. |
| [Status.TimerPart](https://developer.android.com/reference/kotlin/androidx/wear/ongoing/Status.TimerPart)                       | An Ongoing activity status (or part of it) representing a timer.                                                                                                                                                                                                                                               |

*** ** * ** ***

Represents the status or a part of the status of an ongoing activity. Its content may change with time (for example, if the status contains a timer)

## Summary

|                                      ### Public functions                                      |
|------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)                  | [getNextChangeTimeMillis](https://developer.android.com/reference/kotlin/androidx/wear/ongoing/TimeDependentText#getNextChangeTimeMillis(long))`(fromTimeMillis: `[Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)`)` Returns the timestamp of the next time when the display may be different from the one at the specified time.                                                                                                                                                                                                                                                                              |
| [CharSequence](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html) | [getText](https://developer.android.com/reference/kotlin/androidx/wear/ongoing/TimeDependentText#getText(android.content.Context,long))`(context: `[Context](https://developer.android.com/reference/android/content/Context.html)`, timeNowMillis: `[Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)`)` Returns a textual representation of the ongoing activity status or a part of it at the given time represented as milliseconds timestamp For forward compatibility, the best way to display this is on a[android.widget.TextView](https://developer.android.com/reference/android/widget/TextView.html) |

## Public functions

### getNextChangeTimeMillis

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

```
fun getNextChangeTimeMillis(fromTimeMillis: Long): Long
```

Returns the timestamp of the next time when the display may be different from the one at the specified time.  

|                                           Parameters                                            |
|-------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `fromTimeMillis: `[Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html) | current time, usually now as returned by[elapsedRealtime](https://developer.android.com/reference/android/os/SystemClock.html#elapsedRealtime()). In most cases`getText`and`getNextChangeTimeMillis`should be called with the exact same timestamp, so changes are not missed. |

|                                    Returns                                    |
|-------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html) | the first point in time after`fromTimeMillis`when the displayed value of this status may change. returns Long.MAX_VALUE if the display will never change. |

### getText

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

```
fun getText(context: Context, timeNowMillis: Long): CharSequence
```

Returns a textual representation of the ongoing activity status or a part of it at the given time represented as milliseconds timestamp For forward compatibility, the best way to display this is on a[android.widget.TextView](https://developer.android.com/reference/android/widget/TextView.html)  

|                                           Parameters                                           |
|------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `context: `[Context](https://developer.android.com/reference/android/content/Context.html)     | may be used for internationalization. Only used while this method executed.                                                                                                        |
| `timeNowMillis: `[Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html) | the timestamp of the time we want to display, usually now, as returned by[elapsedRealtime](https://developer.android.com/reference/android/os/SystemClock.html#elapsedRealtime()). |