问题
I want to add a condition on OTP recieve app.In which if its not signing up automatically when message come after 15 seconds it should allow the user to manually enter the OTP.I think there must be use of thread or handler?
回答1:
private CountDownTimer countDownTimer = new CountDownTimer(15000, 1000 / 100) {
@Override
public void onTick(long l) {
// call when timer start
}
@Override
public void onFinish() {
Toast.makeText(MainActivity.this, "Done", Toast.LENGTH_SHORT).show();
}
};
to start Timer
countDownTimer.start()
来源:https://stackoverflow.com/questions/36622284/androidif-not-happen-in-15-seconds-do-this-condition