-4

I want start my count down timer after I click start button. I think, I put the syntax in a wrong structural.

Here the code:

enter image description here

Bishan
  • 15,211
  • 52
  • 164
  • 258

1 Answers1

2

Try this on button click

      button.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            new CountDownTimer(30000, 1000) {

                public void onTick(long millisUntilFinished) {
                    mTextField.setText("seconds remaining: " + millisUntilFinished / 1000);
                    //here you can have your logic to set text to edittext
                }

                public void onFinish() {
                    mTextField.setText("done!");
                }

            }.start();
        }
    });