@Override protected void onStop() { super.onStop(); SomUtil.close(); if (gameView != null) { gameView.stopThread(); gameView.unregisterListener(); } finish(); }
@Override public boolean onMenuItemSelected(int featureId, MenuItem item) { super.onMenuItemSelected(featureId, item); switch (item.getItemId()) { case 0: if (gameView.state == GameManager.PAUSE) { gameView.resume(); } else { gameView.pause(); } break; case 1: gameView.restartLevel(); break; } return true; }
@Override protected void onDestroy() { super.onDestroy(); if (gameView != null) { gameView.unregisterListener(); } SomUtil.close(); // gameView.stopThread(); }
protected void onResume() { super.onResume(); if (gameView != null) { // registra no init() // gameView.registerListener(); } if (gameView.state == GameManager.PAUSE) { gameView.resume(); } SomUtil.resume(); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); JogoTarta.logFree("0 - JogoTarta Activity : " + (Runtime.getRuntime().freeMemory() / 1024)); initPreferences(); setContentView(R.layout.tarta); gameView = (GameManager) findViewById(R.id.gameview); gameView.setJogoTarta(this); admobs(); // gameView = new GameManager(this); // setContentView(gameView); }