I've used a CountDownTimer in an android project, and what happens, is, my OnFinish() fires while the CountDown is in its half way stage.
Here is the code :
public void ShowNotice(){
cdt = new CountDownTimer(10000, 1000) {
@Override
public void onTick(long millisUntilFinished) {
// TODO Auto-generated method stub
Toast toast = Toast.makeText(con,"Game Starts In :"+String.valueOf(millisUntilFinished/1000),
Toast.LENGTH_SHORT);
toast.setGravity(Gravity.CENTER_HORIZONTAL, 0, 0);
toast.show();
}
@Override
public void onFinish() {
// TODO Auto-generated method stub
RemoveButtonText();
}
};
cdt.start();
}
RemoveButtonText();// This method gets executed even when the count down isn't finished i.e Toast shows '5'.
Note : cdt is declared as a private member variable inside a class of type CountDownTimer.
Need help :)