我创建了一个Android测验应用程序,我有一个功能考试。在考试中我使用了计时器。定时器工作正常。我使用以下代码段...
public class MyCount extends CountDownTimer{
public MyCount(long millisInFuture, long countDownInterval){
super(millisInFuture, countDownInterval);
}
@Override
public void onFinish() {
timerTextView.setText("Times up!");
result=examAccessoriesObj.calculateExamResult(resultArray);
j = new Intent().setClass(TermExamTestActivity.this,TermExamResultShowActivity.class);
preparePassingValue();
startActivityForResult(j,0);
}
@Override
public void onTick(long millisUntilFinished) {
if((millisUntilFinished/1000%60) < 10){
timerTextView.setText("Time Left " + millisUntilFinished/60000 +
":0" + (millisUntilFinished / 1000)%60);
} else {
timerTextView.setText("Time Left " + millisUntilFinished/60000 +
":" + (millisUntilFinished / 1000)%60);
}
}
}
但问题是在应用程序退出时没有时间或者访问了所有问题时创建。在计数器退出时,退出计数器后,显示结果页面。我怎么解决这个问题。提前谢谢。