Java 倒数计时器自行随机停止
倒计时器自行随机停止,有时工作正常,有时停止,无需手动 达到任何停止条件Java 倒数计时器自行随机停止,java,android,Java,Android,倒计时器自行随机停止,有时工作正常,有时停止,无需手动 达到任何停止条件 你的应用程序崩溃了吗,还是计时器随机停止了?只是计时器随机停止了,我猜这是因为内存使用量很高,200mb/sI我正在制作一个游戏,这是该游戏的计时器 countDownTimer = new CountDownTimer(time, 20) { @Override public void onTick(long l) {
你的应用程序崩溃了吗,还是计时器随机停止了?只是计时器随机停止了,我猜这是因为内存使用量很高,200mb/sI我正在制作一个游戏,这是该游戏的计时器
countDownTimer = new CountDownTimer(time, 20) {
@Override
public void onTick(long l) {
textViewTimer.setText(formatTime(l));
time = l;
strTime = new StringBuilder();
strTime.append(df.format(gameView.percentage));
strTime.append("%");
textViewPercentage.setText(strTime.toString());
if(HoneyBeeGameView.isGameOver){
HoneyBeeGameView.isGameOver = false;
countDownTimer.onFinish();
}
if(gameView.percentage > 95){
time = 60*1000;
gameView.fillAllCells();
showNextLevelDialog();
hasTimerStarted = false;
}
}
@Override
public void onFinish() {
showNextLevelDialog();
}
};
countDownTimer.start();