我想将我的两个进度条重复13次。我猜for循环是否可以解决此问题。进度条的10秒钟开始运行后,重置按钮或停止按钮也不起作用。这是我的倒数计时器代码
private void startCountDownTimer() {
timeCountInMilliSeconds = 30 * 1000;
countDownTimer = new CountDownTimer(timeCountInMilliSeconds, 1000) {
@Override
public void onTick(long millisUntilFinished) {
textViewTime.setText(hmsTimeFormatter(millisUntilFinished));
progressBarCircle.setProgress((int) (millisUntilFinished / 1000));
}
@Override
public void onFinish() {
textViewTime.setText(hmsTimeFormatte(timeCountInMilliSeconds));
setProgressBarValues();
imageViewReset.setVisibility(View.GONE);
imageViewStartStop.setImageResource(R.drawable.icon_start);
timerStatus = TimerStatus.STOPPED;
tenseconds();
}
}.start();
countDownTimer.start();
}
private void tenseconds(){
timeCountInMilliSeconds = 10 * 1000;
countDownTimer = new CountDownTimer(timeCountInMilliSeconds, 1000) {
@Override
public void onTick(long millisUntilFinished) {
textViewTime.setText(hmsTimeFormatter(millisUntilFinished));
progressBarCircle.setProgress((int) (millisUntilFinished / 1000));
}
@Override
public void onFinish() {
textViewTime.setText(hmsTimeFormatter(timeCountInMilliSeconds));
setProgressBarValues();
imageViewReset.setVisibility(View.GONE);
imageViewStartStop.setImageResource(R.drawable.icon_start);
timerStatus = TimerStatus.STOPPED;
startCountDownTimer();
}
}.start();
countDownTimer.start();
}