I'm trying to make a simple countdown timer that shows the remaining time in a toast.
I wrote this code:
new CountDownTimer(10000, 1000) {
    public void onTick(long timeRemaining) {
        Toast.makeText(getBaseContext(), "" + timeRemaining / 1000, 
                                                      Toast.LENGTH_SHORT).show();
    }
    public void onFinish() {
        // do something
    }
}.start();
The problem is that the action that's in the onFinish method is executed when in the toast I'm showing "3".
So, the toast is slower respect the timer.
How can I solve that?
 
     
     
     
     
    