Friday, December 15, 2017

Set the time otp generate in Android Example


//set on time 132 second and resend 


public void reverseTimer(int Seconds,final TextView tv){

    new CountDownTimer(Seconds* 1000+1000, 1000) {

        public void onTick(long millisUntilFinished) {
            int seconds = (int) (millisUntilFinished / 1000);
            int minutes = seconds / 60;
            seconds = seconds % 60;
           tv.setText("TIME : " + String.format("%02d", minutes)
                    + ":" + String.format("%02d", seconds));
        }

        public void onFinish() {
            tv.setText(getString(R.string.nototp));
            tv.setOnClickListener(new View.OnClickListener() {
                @Override                public void onClick(View v) {
                    reverseTimer(90,tv);
                    // new OTPDATA().execute();                }
            });
        }
    }.start();
}

No comments:

Post a Comment

Featured Post

What is JavaScript? What is the role of JavaScript engine?

  The JavaScript is a Programming language that is used for converting static web pages to interactive and dynamic web pages. A JavaScript e...