示例#1
0
 @Override
 public void onRestart() {
   super.onRestart();
   SharedPreferences prefs =
       getSharedPreferences(Constants.Keys.SPF_GAME_STATE, Context.MODE_PRIVATE);
   long time = prefs.getLong(Constants.Keys.TIME, 0l);
   mElapsedTime = time;
   initTimer();
 }
示例#2
0
 @Override
 public void onStop() {
   super.onStop();
   mTimeHandler.removeCallbacksAndMessages(null);
   mTimeHandler = null;
   SharedPreferences prefs =
       getSharedPreferences(Constants.Keys.SPF_GAME_STATE, Context.MODE_PRIVATE);
   prefs.edit().putLong(Constants.Keys.TIME, mElapsedTime).commit();
 }
示例#3
0
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState, R.layout.activity_race, R.color.WHITE);
   initGameView(new Game());
   mScoreTv = (TextView) findViewById(R.id.score);
   updateScore();
   initTimer();
   mTarget = getIntent().getExtras().getInt(Constants.Keys.TARGET);
   initHighScore();
 }