Issue
I have two EditTexts in XML. In one EditText, the user can put a number as minutes and in another EditText, a number as seconds. After clicking the finish button, the seconds EditText should start to countdown and update its text every second.
Additionally, how can I keep it updating until it gets to zero minutes and zero seconds?
Solution
As shown in the documentation for CountDownTimer
:
new CountDownTimer(30000, 1000) { public void onTick(long millisUntilFinished) { mTextField.setText("seconds remaining: " + millisUntilFinished / 1000); // logic to set the EditText could go here } public void onFinish() { mTextField.setText("done!"); } }.start();
Answered By - anon
Answer Checked By - Marilyn (JavaFixing Volunteer)