When writing :
CountDownTimer timer = new CountDownTimer(1000, 100)
{
@Override
public void onTick(long l)
{
}
@Override
public void onFinish()
{
};
}.start();
are we actually starting a new thread that handles ticks? If not, what is really happening?
CountDownTimer
's implementation uses Handler
and sendMessageDelayed()
, so no background thread is needed. This does mean that the timer will not update if you are tying up the main application thread elsewhere in your code.
Definition from multiple publications, tried and tested:
"Another timer is provided with the built-in class CountDownTimer.This encapsulates the creation of a background thread and the handler queuing into a convenient class call..."
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With