0
기본적으로 심장 기능을 수행하고 서로 세 개의 카운트 다운 타이머를 연속적으로 배치하므로 하나의 타이머가 끝나면 다음 타이머가 시작됩니다. 하나는 준비 시간, 다른 하나는 운동 시간, 다른 하나는 휴식 시간입니다. 사용자는이 시간을 선택합니다.카운트 다운 타이머가 루핑되지 않음
사용자가 numberpicker에서 여러 번 선택하면 되겠지만 아무리해도 한 번만 실행되고 반복되지 않으므로 모든 기능이 작동한다는 것을 알 수 있습니다. 일하지 마라.
여기에 뭔가가 있습니까? 이 작업을 수행하는 더 좋은 방법이 있습니까?
//Main countdown timers loop
for(int i = 0; i <= times.getValue() + 1; i++) //times NumberPicker
{
prepCountTimer = new CountDownTimer(_finalPrep * 1000, 1000) {
public void onTick(long millisUntilFinished) {
tvRoundCount.setText("Round " + roundCount + "/" + times.getValue());
tvCountDown.setText((millisUntilFinished/1000) + "s");
if(millisUntilFinished <= (6 * 1000))
{
tvCountDown.setTextColor(Color.RED);
}
}
public void onFinish() {
workoutCountTimer = new CountDownTimer(_finalWorkout * 1000, 1000) {
public void onTick(long millisUntilFinished) {
tvCountDown.setTextColor(Color.GREEN);
tvCountDown.setText((millisUntilFinished/1000) + "s");
if(millisUntilFinished <= 6 * 1000)
{
tvCountDown.setTextColor(Color.RED);
}
}
public void onFinish() {
restCountTimer = new CountDownTimer(_finalRest * 1000, 1000) {
public void onTick(long millisUntilFinished) {
tvCountDown.setTextColor(Color.GREEN);
tvCountDown.setText((millisUntilFinished/1000) + "s");
if(millisUntilFinished <= 6 * 1000)
{
tvCountDown.setTextColor(Color.RED);
}
}
public void onFinish() {
roundCount = roundCount + 1;
}
}.start();
}
}.start();
}
}.start();
}
어떻게하면됩니까? 나는 사용자가 선택한 것에 따라 x 번 반복하지 않는 이유를 이해하지 못한다 ... – user1875797
나는 어떻게 대답 할 수 있는지 보여주기 위해 나의 대답을 편집했다. – Eluvatar