@Override public void onPause() { super.onPause(); GameLoop.instance().stopLevelAndLoop(); stars_creator.stopSpawningStars(); adView.pause(); MediaController.stopLoopingSound(); }
@Override public void onResume() { super.onResume(); GameLoop.instance().startLevelAndLoop(this, null); stars_creator.startSpawningStars(); // set GameTextViews here, as the text may have updated since onCreate // (user plays game, gets new record, and goes back to mainActivity) SharedPreferences gameMeta = getSharedPreferences(MainActivity.GAME_META_DATA_PREFS, 0); GameTextView score = (GameTextView) findViewById(R.id.high_score); score.setText(formatInt(gameMeta.getInt(HIGHEST_SCORE, 0))); GameTextView days = (GameTextView) findViewById(R.id.max_day); days.setText(formatInt(gameMeta.getInt(MAX_LEVEL, 0))); adView.resume(); MediaController.playSoundClip(this, R.raw.background_intro, true); }