TimerSpan


@ExperimentalCarApi
@CarProtocol
public final class TimerSpan extends CarSpan


A CarSpan that represents a timer.

This span can be used within text to display a live-updating timer. The timer will count up from the provided start time, which is based on the elapsed real time since device boot, as provided by SystemClock.elapsedRealtime().

For example, a TimerSpan can be used in a CarText to show how much time has passed since a certain event. The exact rendering of the timer is dependent on the car screen.

See also
CarSpan

Summary

Public methods

static @NonNull TimerSpan
create(long elapsedRealtimeMillis)

Creates a TimerSpan from a start time in elapsed real time since device boot.

boolean
long

Returns the start time of the timer in milliseconds since device boot.

int
@NonNull String

Public methods

create

Added in 1.8.0-beta01
public static @NonNull TimerSpan create(long elapsedRealtimeMillis)

Creates a TimerSpan from a start time in elapsed real time since device boot.

The timer will count up if the provided elapsedRealtimeMillis is in the past relative to the current SystemClock.elapsedRealtime(), and will count down if it is in the future.

Parameters
long elapsedRealtimeMillis

the start time in milliseconds using SystemClock .elapsedRealtime().

equals

public boolean equals(@Nullable Object other)

getElapsedRealtimeMillis

Added in 1.8.0-beta01
public long getElapsedRealtimeMillis()

Returns the start time of the timer in milliseconds since device boot.

hashCode

public int hashCode()

toString

public @NonNull String toString()