Exemplo n.º 1
0
  /*
   * This method forces the back button to behave properly.
   * It is needed to prevent a crash if the user opens up the
   * game immediately after hitting back
   */
  @Override
  public void onBackPressed() {

    if (!game.isPaused()) {
      game.pause();
    } else {
      game.resume();
    }
  }