@Override
 public boolean onOptionsItemSelected(MenuItem item) {
   switch (item.getItemId()) {
     case QUIT_MENU_ID:
       GeoQuestApp.getInstance().terminateApp();
       break;
     case END_GAME_MENU_ID:
       GeoQuestApp.getInstance().endGame();
       break;
     case PREFS_MENU_ID:
       Intent settingsActivity = new Intent(getBaseContext(), Preferences.class);
       startActivity(settingsActivity);
       break;
   }
   return super.onOptionsItemSelected(item);
 }
Beispiel #2
0
  /** Starts the mission using an Intent that only has the minimal extras, namely the mission ID. */
  public void startMission() {
    Intent startingIntent = this.startingIntent;
    if (GeoQuestApp.useAdaptionEngine) {
      String alternMissionId = GeoQuestApp.adaptionEngine.getAlternativeMission(id);
      if (!alternMissionId.equals(id)) {
        if (Mission.existsMission(alternMissionId)) {
          AlternativeMission alternativeM = (AlternativeMission) Mission.get(alternMissionId);
          alternativeM.setPlaceholderId(id);
          startingIntent = ((Mission) alternativeM).startingIntent;
        } else {
          AlternativeMission alternativeM = AlternativeMission.create(alternMissionId, id);
          startingIntent = ((Mission) alternativeM).startingIntent;
        }
      }
    }

    if (startingIntent != null) {
      GeoQuestApp.stopAudio();
      getMainActivity().startActivityForResult(startingIntent, 1);
    } else Log.e(this.getClass().getName(), "Mission can NOT be started since Intent is null.");
  }
 protected void onDestroy() {
   if (isFinishing()) {
     GeoQuestApp.getInstance().removeActivity(this);
   }
   super.onDestroy();
 }
 @Override
 protected void onResume() {
   super.onResume();
   GeoQuestApp.setCurrentActivity(this);
 }