new CountDownTimer(1000000, 1000) {
public void onTick(long millisUntilFinished) {
// Used for formatting digit to be in 2 digits only
NumberFormat f = new DecimalFormat("00");
long min = (millisUntilFinished / 60000) % 60;
long sec = (millisUntilFinished / 1000) % 60;
timer.setText("OTP Expires in: " + f.format(min) + ":" + f.format(sec));
}
I am supposed to delete a OTP after the timer runs out which in this case is 10 minutes. I am not sure how to set the timer to 10 minutes.
2
Answers
You can see it in CountDownTimer
try this