I’ve got a private int counter inside my class and I initialized it as counter = 3;inside my OnCreate().
This is my countdown codes inside my OnCreate:
new CountDownTimer(3000, 1000) {
public void onTick(long msUntilFinished) {
if (counter==3){
Toast.makeText(StartSingle.this, "3", Toast.LENGTH_SHORT).show();
counter--;
}else if (counter==2){
Toast.makeText(StartSingle.this, "2", Toast.LENGTH_SHORT).show();
counter--;
}else if (counter==1){
Toast.makeText(StartSingle.this, "1", Toast.LENGTH_SHORT).show();
counter--;
}else if (counter==0){
Toast.makeText(StartSingle.this, "Go!", Toast.LENGTH_SHORT).show();
}
}
`
OnTick will be called at 2000, 1000, 0. At this time your counter = 1. It will not be 0.
You initial value for counter should be 2 perhaps.