android:If not happen in 15 seconds do this condition

梦想的初衷 提交于 2019-12-12 02:53:14

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!