Added in API level 1

Chronometer


open class Chronometer : TextView
kotlin.Any
   ↳ android.view.View
   ↳ android.widget.TextView
   ↳ android.widget.Chronometer

Class that implements a simple timer.

You can give it a start time in the SystemClock.elapsedRealtime timebase, and it counts up from that, or if you don't give it a base time, it will use the time at which you call start.

The timer can also count downward towards the base time by setting setCountDown(boolean) to true.

By default it will display the current timer value in the form "MM:SS" or "H:MM:SS", or you can use setFormat to format the timer value into an arbitrary string.

Summary

Nested classes
abstract

A callback that notifies when the chronometer has incremented on its own.

XML attributes
android:countDown Specifies whether this Chronometer counts down or counts up from the base.
android:format Format string: if specified, the Chronometer will display this string, with the first "%s" replaced by the current timer value in "MM:SS" or "H:MM:SS" form.
Inherited XML attributes
Inherited constants
Public constructors
Chronometer(context: Context!)

Initialize this Chronometer object.

Chronometer(context: Context!, attrs: AttributeSet!)

Initialize with standard view layout information.

Chronometer(context: Context!, attrs: AttributeSet!, defStyleAttr: Int)

Initialize with standard view layout information and style.

Chronometer(context: Context!, attrs: AttributeSet!, defStyleAttr: Int, defStyleRes: Int)

Public methods
open CharSequence!

open Long

Return the base time as set through setBase.

open CharSequence!

open String!

Returns the current format string as set through setFormat.

open Chronometer.OnChronometerTickListener!

open Boolean

open Boolean

open Unit
setBase(base: Long)

Set the time that the count-up timer is in reference to.

open Unit
setCountDown(countDown: Boolean)

Set this view to count down to the base instead of counting up from it.

open Unit
setFormat(format: String!)

Sets the format string used for display.

open Unit

Sets the listener to be called when the chronometer changes.

open Unit

Start counting up.

open Unit

Stop counting up.

Protected methods
open Unit

open Unit
onVisibilityChanged(changedView: View, visibility: Int)

open Unit

Inherited functions