tags:

views:

10

answers:

1

After I Bind to a service inside the

onServiceConnected()

method I start a CountDownTimer. The problem is that the timer does not start counting down. I have gone through with the debugger and sure enough it is executing the method that starts the Timer.

If I use a button to start the timer it works! What could I be doing wrong?

A: 

It is possible onServiceConnected() is being fired too early or something. Try calling postDelayed() on your CountDownTimer, supplying a Runnable that starts the CountDownTimer and a delay of, say, 250ms.

CommonsWare
Worked nicely. I used a Handler to run postDelayed() is that the best way to go?
jax
If you already had a Handler, sure. However, `postDelayed()` is also on `View` (of which `CountDownTimer` is a subclass), so you don't need a `Handler` just for `postDelayed()`.
CommonsWare