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:
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:
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();
}
});