Android Guides | Samples

Android.OS.CountDownTimer Class

Schedule a countdown until a time in the future, with regular notifications on intervals along the way.

See Also: CountDownTimer

Syntax

[Android.Runtime.Register("android/os/CountDownTimer", DoNotGenerateAcw=true)]
public abstract class CountDownTimer : Object

Remarks

Schedule a countdown until a time in the future, with regular notifications on intervals along the way. Example of showing a 30 second countdown in a text field:

java Example

 new CountDownTimer(30000, 1000) {

     public void onTick(long millisUntilFinished) {
         mTextField.setText("seconds remaining: " + millisUntilFinished / 1000);
     }

     public void onFinish() {
         mTextField.setText("done!");
     }
  }.start();
The calls to CountDownTimer.OnTick(Int64) are synchronized to this object so that one call to CountDownTimer.OnTick(Int64) won't ever occur before the previous callback is complete. This is only relevant when the implementation of CountDownTimer.OnTick(Int64) takes an amount of time to execute that is significant compared to the countdown interval.

[Android Documentation]

Requirements

Namespace: Android.OS
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
Since: Added in API level 1

The members of Android.OS.CountDownTimer are listed below.

See Also: Object

Public Constructors

Protected Constructors

A constructor used when creating managed representations of JNI objects; called by the runtime.

Protected Properties

[read-only]
override
ThresholdClassIntPtr. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.
[read-only]
override
ThresholdTypeType. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

Public Methods

Cancel()
Cancel the countdown.
abstract
OnFinish()
Callback fired when the time is up.
abstract
OnTick(Int64)
Callback fired on regular interval.
Start() : CountDownTimer
Start the countdown.