Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/337.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/226.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 倒数计时器自行随机停止_Java_Android - Fatal编程技术网

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();