【发布时间】:2017-11-14 10:23:49
【问题描述】:
我做了一个安卓游戏,一旦我最小化它, 它会重置数据并刷新计时器,就像您从头开始游戏一样 我怎样才能做到不要这样做
我认为问题出在 OnStart 函数上
protected void onStart() {
super.onStart();
// Reset score
Configs.score = 0;
scoreTxt.setText(String.valueOf(Configs.score));
// Set progressBar and start the gameTimer
pb = (ProgressBar)findViewById(R.id.gbProgressBar);
progress = 0;
pb.setProgress((int) progress);
startGameTimer();
// Get a random circle for letters
Random r = new Random();
randomCircle = r.nextInt(Configs.circlesArray.length);
// Reset taps count
tapsCount = -1;
// Get a random word from words string-array
getRandomWord();
}
【问题讨论】: