protected void destroyApp(boolean unconditional) {
    final String METHOD_NAME = "GameMidlet::destroyApp";
    try {
      PreLogUtil.put(AllGameStatisticsFactory.getInstance().toString(), this, METHOD_NAME);
      // LogUtil.put(LogFactory.getInstance(CommonStrings.getInstance().START, this, METHOD_NAME));

      GameAdState gameAdState = GameAdStateFactory.getInstance().getCurrentInstance();

      gameAdState.getAdvertisements().stopAll();

      if (!this.isDestroyed()) {
        this.stopGameCanvasRunnableInterface();
        this.setGameCanvasRunnableInterface(null);
        // if(!AppletUtil.isAppletLoader(this))
        // {
        this.mediaShutdown();
        // }
      } else {
        LogUtil.put(
            LogFactory.getInstance(
                "Midlet Managment Error: Midlet Should Only Be Destroyed Once", this, METHOD_NAME));
      }

      super.destroyApp(true);

      // LogUtil.put(LogFactory.getInstance(CommonStrings.getInstance().END, this, METHOD_NAME));
      PreLogUtil.put(CommonStrings.getInstance().END, this, METHOD_NAME);
    } catch (Exception e) {
      LogUtil.put(
          LogFactory.getInstance(CommonStrings.getInstance().EXCEPTION, this, METHOD_NAME, e));
    }
    LogUtil.put(LogFactory.getInstance(CommonStrings.getInstance().END, this, METHOD_NAME));
    PreLogUtil.put(CommonStrings.getInstance().END, this, METHOD_NAME);
  }
  public boolean after(String text, String after) {
    try {
      int index = this.string.indexOf(after);

      if (index < 0) {
        System.out.println("No such start: " + after + " in: " + this.string);
        return false;
      }

      index = index + after.length();

      String start = this.string.substring(0, index);

      String end = this.string.substring(index + 1, this.string.length());

      FileOutputStream idFile = new FileOutputStream(this.fileName);
      DataOutputStream idOutData = new DataOutputStream(idFile);
      idOutData.writeBytes(start + text + end);
      // System.out.println("Output: " + start + text + end);

      idOutData.close();
      idFile.close();

      return true;
    } catch (Exception e) {
      if (org.allbinary.logic.communication.log.config.type.LogConfigTypes.LOGGING.contains(
          org.allbinary.logic.communication.log.config.type.LogConfigType.IDLOGGING)) {
        LogUtil.put(
            LogFactory.getInstance(CommonStrings.getInstance().EXCEPTION, this, "after", e));
      }
      return false;
    }
  }
  public void startNewSong() {
    try {
      // PreLogUtil.put(Memory.getInfo(), this, CommonStrings.getInstance().PROCESS);

      ResourceUtil.getInstance().getContext().stopService(this.currentIntent);

      this.currentSongSound = (Sound) BasicArrayListUtil.getInstance().getRandom(this.songList);

      long duration = this.currentSongSound.getDuration();
      // 18000;
      // this.currentSongSound.getPlayer().getDuration();

      PreLogUtil.put(
          new StringBuilder()
              .append(PLAY)
              .append(this.currentSongSound.getResource())
              .append(FOR)
              .append(duration)
              .toString(),
          this,
          CommonStrings.getInstance().PROCESS);

      this.timeDelayHelper.setDelay((int) duration);

      this.currentIntent.putExtra(
          MusicStrings.getInstance().SONG_EXTRA,
          ResourceUtil.getInstance().getResourceId(this.currentSongSound.getResource()).intValue());

      ResourceUtil.getInstance().getContext().startService(this.currentIntent);
    } catch (Exception e) {
      String resource = StringUtil.getInstance().EMPTY_STRING;
      if (currentSongSound != null) {
        resource = currentSongSound.getResource();
      }

      PreLogUtil.put(
          CommonStrings.getInstance().EXCEPTION_LABEL + resource,
          this,
          CommonStrings.getInstance().PROCESS,
          e);
    }
  }
  protected void startApp() {
    try {
      GameAdState gameAdState = GameAdStateFactory.getInstance().getCurrentInstance();

      gameAdState.getAdvertisements().startAll();

      final String START_APP = "startApp";

      LogUtil.put(LogFactory.getInstance(CommonStrings.getInstance().START, this, START_APP));
      // PreLogUtil.put(CommonStrings.getInstance().START, this, START_APP);

      GameCanvasRunnableInterface gameCanvasRunnableInterface =
          this.allbinaryGameCanvasRunnableInterface;

      // If the first time/null then start demo or unpausing
      // thus start up only occurs one time ever otherwise this is just unpause
      if (gameCanvasRunnableInterface == null) {
        gameMidletStateFactory.setCurrentGameState(GameState.NO_GAME_STATE);
        this.setDemo();
      } else {
        LogUtil.put(
            LogFactory.getInstance("GameCanvasRunnableInterface is available", this, START_APP));

        // Starting midlet after a previous start means that we only unpause the
        // GameCanvasRunnableInterface if it is currently displayed
        if (gameCanvasRunnableInterface == this.getCurrentDisplayable()) {
          this.unPauseAppBackground(false);
        } else {
          LogUtil.put(
              LogFactory.getInstance(
                  "GameCanvasRunnableInterface is not current displayable", this, START_APP));
        }
      }
    } catch (Exception e) {
      LogUtil.put(
          LogFactory.getInstance(CommonStrings.getInstance().EXCEPTION, this, "startApp", e));
      destroyApp(false);
      // TWB - Only remove from context when multiple midlets share the same emulator
      notifyDestroyed();
    }
  }
  private NoGameNotificationHudSingleton() {
    try {
      BasicHudFactory basicHudFactory = BasicHudFactory.getInstance();

      this.gameNotificationHud =
          new GameNotificationHud(
              basicHudFactory.TOPCENTER,
              basicHudFactory.HORIZONTAL,
              14,
              40,
              2,
              BasicColorFactory.getInstance().RED);
    } catch (Exception e) {
      LogUtil.put(
          LogFactory.getInstance(
              CommonStrings.getInstance().EXCEPTION,
              this,
              CommonStrings.getInstance().CONSTRUCTOR,
              e));
    }
  }
  protected void stopGameCanvasRunnableInterface() throws Exception {
    LogUtil.put(
        LogFactory.getInstance(
            CommonStrings.getInstance().START, this, "stopGameCanvasRunnableInterface"));

    GameNotificationEventHandler.getInstance().removeAllListeners();
    ColorChangeEventHandler.getInstance().removeAllListeners();
    GameEventHandlerUtil.removeAllListeners();

    // TWB- Depends on the phone - emulators like it without but i think my
    // sprint phone needed a null canvas
    // this.setDisplay((Displayable) new ProgressCanvas(this));

    GameCanvasRunnableInterface gameCanvasRunnableInterface =
        this.allbinaryGameCanvasRunnableInterface;
    if (gameCanvasRunnableInterface != null) {
      LogUtil.put(
          LogFactory.getInstance("Set Running False", this, "stopGameCanvasRunnableInterface"));
      gameCanvasRunnableInterface.setRunning(false);
    } else {
      LogUtil.put(
          LogFactory.getInstance(
              "StopGame - Could Not Stop", this, "stopGameCanvasRunnableInterface"));
    }

    // Wait for the thread to end then continue
    ThreadUtil.getInstance().join(this.thread);

    if (Features.getInstance().isFeature(MainFeatureFactory.getInstance().LOAD_ALL)) {
      ProgressCanvasFactory.getInstance().addPortion(50, "Stopped Game Runnable");
    } else {
      ProgressCanvasFactory.getInstance().addPortion(50, "Stopped Main Runnable");
    }

    LogUtil.put(
        LogFactory.getInstance(
            CommonStrings.getInstance().END, this, "stopGameCanvasRunnableInterface"));
  }
 public boolean atEnd(String text) {
   try {
     FileOutputStream idFile = new FileOutputStream(this.fileName);
     DataOutputStream idOutData = new DataOutputStream(idFile);
     idOutData.writeBytes(this.string + text);
     return true;
   } catch (Exception e) {
     if (org.allbinary.logic.communication.log.config.type.LogConfigTypes.LOGGING.contains(
         org.allbinary.logic.communication.log.config.type.LogConfigType.IDLOGGING)) {
       LogUtil.put(
           LogFactory.getInstance(CommonStrings.getInstance().EXCEPTION, this, "insertAtEnd", e));
     }
     return false;
   }
 }
  public void show() {
    for (int index = this.songList.size(); --index >= 0; ) {
      Sound sound = (Sound) this.songList.get(index);

      long duration = sound.getPlayer().getDuration();

      PreLogUtil.put(
          new StringBuilder()
              .append(PLAY)
              .append(sound.getResource())
              .append(FOR)
              .append(duration)
              .toString(),
          this,
          CommonStrings.getInstance().PROCESS);
    }
  }
  public Hashtable getCurrentStateHashtable() throws Exception {
    LogUtil.put(
        LogFactory.getInstance(
            CommonStrings.getInstance().START, this, "getCurrentStateHashtable"));
    Hashtable hashtable = new Hashtable();

    if (this.allbinaryGameCanvasRunnableInterface != null) {
      Hashtable currentHashtable =
          this.allbinaryGameCanvasRunnableInterface.getCurrentStateHashtable();
      Enumeration enumeration = currentHashtable.keys();
      while (enumeration.hasMoreElements()) {
        Object key = enumeration.nextElement();
        hashtable.put(key, currentHashtable.get(key));
      }
    }

    return hashtable;
  }
  protected void pauseAppBackground(boolean background) {
    final String METHOD_NAME = "pauseAppBackground";
    LogUtil.put(LogFactory.getInstance(CommonStrings.getInstance().START, this, METHOD_NAME));
    // PreLogUtil.put(CommonStrings.getInstance().START, this, METHOD_NAME);

    if (allbinaryGameCanvasRunnableInterface != null) {
      allbinaryGameCanvasRunnableInterface.pause();
      /*
      if (!allbinaryGameCanvasRunnableInterface.isPaused())
      {
          allbinaryGameCanvasRunnableInterface.pause();
      }
       */
    } else {
      LogUtil.put(LogFactory.getInstance("<<<<<< Null", this, METHOD_NAME));
    }

    AllBinarySensorManager.getInstance().shutdown();
  }
  protected void unPauseAppBackground(boolean background) {
    final String METHOD_NAME = "unPauseAppBackground";
    LogUtil.put(LogFactory.getInstance(CommonStrings.getInstance().START, this, METHOD_NAME));
    // PreLogUtil.put(CommonStrings.getInstance().START, this, METHOD_NAME);

    AllBinarySensorManager.getInstance().init();

    GameCanvasRunnableInterface gameCanvasRunnableInterface =
        this.allbinaryGameCanvasRunnableInterface;

    if (gameCanvasRunnableInterface != null) {
      gameCanvasRunnableInterface.unPause();
      /*
      if (gameCanvasRunnableInterface.isPaused())
      {
          gameCanvasRunnableInterface.unPause();
      }
      */
    } else {
      LogUtil.put(LogFactory.getInstance("<<<<<< Null", this, METHOD_NAME));
    }
  }
  public void processInput(AllBinaryLayerManager layerManager) throws Exception {
    try {
      int size = inputList.size();
      int key = 0;

      for (int index = 0; index < size; index++) {
        GameKeyEvent gameKeyEvent = (GameKeyEvent) inputList.get(index);
        key = gameKeyEvent.getKey();

        this.processInput(key);
      }

      if (isSingleKeyProcessing) {
        this.clear();
      } else {
        this.update();
      }

    } catch (Exception e) {
      LogUtil.put(
          LogFactory.getInstance(CommonStrings.getInstance().EXCEPTION, this, "processInput", e));
    }
  }
  public void save() throws Exception {
    LogUtil.put(LogFactory.getInstance(CommonStrings.getInstance().START, this, "save"));

    Hashtable hashtable = this.getCurrentStateHashtable();
    GamePersistanceSingleton.getInstance().save(hashtable);
  }
  public synchronized void commandAction(Command command, Displayable displayable) {
    try {
      String displayableAsString = NO_DISPLAYABLE;
      if (displayable != null) {
        displayableAsString = displayable.toString();
      }

      String label = NO_COMMAND;
      if (command != null) {
        label = command.getLabel();
      }

      PreLogUtil.put(
          new StringMaker()
              .append(COMMAND_NAME)
              .append(label)
              .append(DISPLAYABLE)
              .append(displayableAsString)
              .toString(),
          this,
          this.COMMAND_ACTION);

      GameCommandsFactory gameCommandsFactory = GameCommandsFactory.getInstance();

      if (command == gameCommandsFactory.SHOW_GAME_CANVAS) {
        // TWB - If progress concurrency is a problem then this is probably the cause
        if (this.getDisplay().getCurrent() != this.allbinaryGameCanvasRunnableInterface) {
          this.setDisplay((Displayable) this.allbinaryGameCanvasRunnableInterface);
        }

        this.unPauseAppBackground(false);
      } else if (command == gameCommandsFactory.CLOSE_AND_SHOW_GAME_CANVAS) {
        // this.closeMenuListener();
        MenuListener menuListener = (MenuListener) displayable;
        menuListener.close();

        this.setDisplay((Displayable) this.allbinaryGameCanvasRunnableInterface);
        this.unPauseAppBackground(false);
      } else if (command == gameCommandsFactory.EXIT_COMMAND) {
        // TWB - Handle exit for android differently
        if (GameMidletEventHandler.getInstance().getEventListenerInterfaceList().size() == 0) {
          this.exit(true);
        }

        GameMidletEventHandler.getInstance().fireEvent(null);
      } else if (command == gameCommandsFactory.EXIT_WITHOUT_PROGRESS_COMMAND) {
        this.exit(false);
      } else if (command == gameCommandsFactory.START_COMMAND
          || command == gameCommandsFactory.RESTART_COMMAND
          || command == gameCommandsFactory.CONTINUE_COMMAND) {
        // GameState gameState = GameStateFactory.getInstance(command);
        if (gameMidletStateFactory.getCurrentGameState() != GameState.PLAYING_GAME_STATE
            || command == gameCommandsFactory.RESTART_COMMAND) {
          if (this.gameStartTimeHelper.isTime()) {
            this.createGame();
            gameMidletStateFactory.setCurrentGameState(GameState.PLAYING_GAME_STATE);
          } else {
            LogUtil.put(
                LogFactory.getInstance(
                    "Starting Game Too Often", this, MidletStrings.getInstance().COMMAND_ACTION));
          }

        } else {
          LogUtil.put(LogFactory.getInstance("Already in playing state", this, COMMAND_ACTION));
        }

      } else if (command == gameCommandsFactory.BUY_COMMAND) {
        InApplicationPurchaseFactory inApplicationPurchaseFactory =
            InApplicationPurchaseFactory.getInstance();

        final BasicArrayList list = LockableFeatureFactory.getInstance().getList();
        LockableFeature lockableFeature = (LockableFeature) list.get(0);

        if (list.size() > 0 && !inApplicationPurchaseFactory.isPurchased(lockableFeature)) {
          inApplicationPurchaseFactory.purchase(lockableFeature);
          // TextNotificationUtil.getInstance().fireSuccess("In Application Purchase Request");
        } else {
          TextNotificationUtil.getInstance().fireSuccess("Already Purchased");
        }
      } else if (command == gameCommandsFactory.QUIT_COMMAND) {
        if (this.gameStartTimeHelper.isTime()) {
          this.stopGameCanvasRunnableInterface();
          gameMidletStateFactory.setCurrentGameState(GameState.NO_GAME_STATE);
          this.setDemo();
        }
      } else if (command == MyCommandsFactory.getInstance().RESUME_COMMAND) {
        this.unPauseAppBackground(false);
      } else if (command == MyCommandsFactory.getInstance().PAUSE_COMMAND) {
        this.pauseAppBackground(false);
      } else if (command == MyCommandsFactory.getInstance().SET_DISPLAYABLE) {
        this.pauseAppBackground(false);

        this.setDisplay(displayable);
      } else if (command == gameCommandsFactory.SET_MENU_DISPLAYABLE) {
        this.pauseAppBackground(false);

        MenuListener menuListener = (MenuListener) displayable;
        menuListener.open();

        this.setDisplay(displayable);
      } else if (command == gameCommandsFactory.START_TRACE) {
        this.debugInterface.start();
        ((AllBinaryGameCanvas) this.allbinaryGameCanvasRunnableInterface)
            .addCommand(gameCommandsFactory.STOP_TRACE);
        ((AllBinaryGameCanvas) this.allbinaryGameCanvasRunnableInterface)
            .removeCommand(gameCommandsFactory.START_TRACE);
      } else if (command == gameCommandsFactory.STOP_TRACE) {
        this.pauseAppBackground(false);
        this.debugInterface.stop();
        this.unPauseAppBackground(false);
        ((AllBinaryGameCanvas) this.allbinaryGameCanvasRunnableInterface)
            .addCommand(gameCommandsFactory.START_TRACE);
        ((AllBinaryGameCanvas) this.allbinaryGameCanvasRunnableInterface)
            .removeCommand(gameCommandsFactory.STOP_TRACE);
      } else if (command == gameCommandsFactory.DEFAULT_OPTIONS) {
        Displayable tempDisplayable = displayable;
        if (tempDisplayable instanceof GameOptionsForm) {
          GameFeatureFormUtil.getInstance().setDefault((CommandForm) tempDisplayable);
        }
      } else if (command == GameInputMappingInstructionsCanvas.DISPLAY) {
        Displayable tempDisplayable = displayable;
        if (tempDisplayable instanceof GameInputMappingCanvas) {
          GameInputMappingCanvas gameInputMappingCanvas = (GameInputMappingCanvas) tempDisplayable;
          gameInputMappingCanvas.update();
        }

        this.commandAction(
            gameCommandsFactory.SET_MENU_DISPLAYABLE, this.getInputMappingInstructionsCanvas());

        // this.setDisplay((Displayable) this.getInputMappingInstructionsCanvas());
      } else if (HighScoreCommandsFactory.getInstance().isHighScoreCommand(command)) {
        Displayable tempDisplayable = displayable;
        if (tempDisplayable instanceof HighScoresCanvas) {
          HighScoresCanvas highScoresCanvas = (HighScoresCanvas) tempDisplayable;

          highScoresCanvas.updateCommand(command);
        }
      } else if (command == HighScoreCommands.getInstance().DISPLAY) {
        this.commandAction(gameCommandsFactory.SET_MENU_DISPLAYABLE, this.createHighScoresCanvas());
      } else if (command == GameInputMappingInstructionsCanvas.CLOSE) {
        MenuListener menuListener = (MenuListener) displayable;
        menuListener.close();

        this.commandAction(GameInputMappingCanvas.DISPLAY, null);
      } else if (command == GameInputMappingCanvas.DISPLAY) {
        // TWB - Called for HTML5 but not others?
        Features features = Features.getInstance();

        if (features.isDefault(HTMLFeatureFactory.getInstance().HTML)) {
          this.pauseAppBackground(false);
        }

        this.commandAction(gameCommandsFactory.SET_MENU_DISPLAYABLE, this.getInputMappingCanvas());

        // this.setDisplay((Displayable) this.getInputMappingCanvas());
      } else if (command == GameInputMappingCanvas.DEFAULT) {
        Displayable tempDisplayable = displayable;
        if (tempDisplayable instanceof GameInputMappingCanvas) {
          GameInputMappingCanvas gameInputMappingCanvas = (GameInputMappingCanvas) tempDisplayable;
          gameInputMappingCanvas.setDefault();
        }
      } else if (command == InGameOptionsForm.DISPLAY) {
        this.pauseAppBackground(false);

        ProgressCanvas progressCanvas = ProgressCanvasFactory.getInstance();

        progressCanvas.addPortion(50, "In Game Options");

        AllBinaryGameLayerManager layerManager = this.createGameLayerManager();

        InGameOptionsFormFactory.init(
            this,
            new InGameFeatures(),
            "Options In Game",
            layerManager.getBackgroundBasicColor(),
            layerManager.getForegroundBasicColor());

        InGameOptionsForm inGameOptionsForm = InGameOptionsFormFactory.getInstance();

        inGameOptionsForm.setItemStateListener(this.allbinaryGameCanvasRunnableInterface);

        this.commandAction(gameCommandsFactory.SET_MENU_DISPLAYABLE, inGameOptionsForm);
      } else if (command == InGameOptionsForm.DEFAULT) {
        GameFeatureFormUtil.getInstance().setDefault(InGameOptionsFormFactory.getInstance());
      } else if (command == gameCommandsFactory.DISPLAY_OPTIONS) {
        AllBinaryMediaManager.setMuted(true);
        this.stopAll();

        MainFeatureFactory mainFeatureFactory = MainFeatureFactory.getInstance();
        Features features = Features.getInstance();

        isFullScreen = features.isFeature(mainFeatureFactory.FULL_SCREEN);

        // PreLogUtil.put("Open isFullScreen: " + isFullScreen, this,
        // MidletStrings.getInstance().COMMAND_ACTION);

        ResizableListenerHandler.getInstance().fireEvent(true);

        this.setResized(false);

        this.commandAction(gameCommandsFactory.SET_MENU_DISPLAYABLE, this.getGameOptionsForm());
      } else if (command == gameCommandsFactory.CLOSE_OPTIONS) {
        // PreLogUtil.put("Close", this, MidletStrings.getInstance().COMMAND_ACTION);
        ResizableListenerHandler.getInstance().fireEvent(false);

        this.commandAction(gameCommandsFactory.CLOSE_AND_SHOW_GAME_CANVAS, displayable);

        StringMaker stringBuffer = new StringMaker();
        stringBuffer.append("Close isFullScreen/change: ");
        stringBuffer.append(isFullScreen);
        stringBuffer.append(FullScreenUtil.isScreenChange(isFullScreen));
        stringBuffer.append(" isResized: ");
        stringBuffer.append(this.isResized());

        PreLogUtil.put(stringBuffer.toString(), this, COMMAND_ACTION);

        // Restart canvas if screen change
        if (this.isResized() || FullScreenUtil.isScreenChange(isFullScreen)) {
          // PreLogUtil.put("Resized/Changed", this, MidletStrings.getInstance().COMMAND_ACTION);

          this.updateFullScreen();
        }

        AllBinaryMediaManager.setMuted(false);
      } else if (command == gameCommandsFactory.DISPLAY_LOAD_FORM) {
        this.pauseAppBackground(false);

        KeyValuePersistance keyValuePersistance = GamePersistanceSingleton.getInstance();

        keyValuePersistance.clear();
        keyValuePersistance.loadAll();

        if (this.getLoadGameForm() == null) {
          AllBinaryGameLayerManager layerManager = this.createGameLayerManager();

          this.setLoadGameForm(
              new LoadGameForm(
                  this,
                  "Load Game",
                  layerManager.getBackgroundBasicColor(),
                  layerManager.getForegroundBasicColor()));
        } else {
          this.getLoadGameForm().update();
        }

        this.commandAction(gameCommandsFactory.SET_MENU_DISPLAYABLE, this.getLoadGameForm());

        // this.setDisplay((Displayable) this.getLoadGameForm());
      } else if (command == gameCommandsFactory.LOAD_FILE) {
        int index = this.getLoadGameForm().getSelectedId();

        if (index != -1) {
          KeyValuePersistance keyValuePersistance = GamePersistanceSingleton.getInstance();

          this.setStartStateHashtable(keyValuePersistance.get(index));

          MenuListener menuListener = this.getLoadGameForm();
          menuListener.close();

          PreLogUtil.put(BasicMotionGesturesHandler.getInstance().toString(), this, COMMAND_ACTION);

          this.commandAction(gameCommandsFactory.START_COMMAND, null);

          PreLogUtil.put(BasicMotionGesturesHandler.getInstance().toString(), this, COMMAND_ACTION);
        }
      } else if (command == gameCommandsFactory.DELETE_FILE) {
        int index = this.getLoadGameForm().getSelectedText();

        if (index != -1) {
          KeyValuePersistance keyValuePersistance = GamePersistanceSingleton.getInstance();

          keyValuePersistance.delete(index);
          keyValuePersistance.clear();
          keyValuePersistance.loadAll(1);
          this.getLoadGameForm().update();
        }
      }
      /*
      else if (command == GameCommands.DISPLAY_SAVE_FORM)
      {
      this.pauseApp();
      this.setDisplay((Displayable) this.getSaveGameForm());
      }*/
      else if (command == gameCommandsFactory.SAVE) {
        KeyValuePersistance keyValuePersistance = GamePersistanceSingleton.getInstance();

        this.pauseAppBackground(false);
        // String name = ((SaveGameForm) this.getSaveGameForm()).getText();
        keyValuePersistance.save(this.getCurrentStateHashtable());

        // this.setDisplay((Displayable) allbinaryGameCanvasRunnableInterface);

        this.unPauseAppBackground(false);
      } else if (command == HighScoreTextBox.SUBMIT_TEXTBOX_COMMAND) {
        LogUtil.put(LogFactory.getInstance("Submitted Score", this, COMMAND_ACTION));

        this.allbinaryGameCanvasRunnableInterface.setHighScoreSubmitted(true);

        this.commandAction(gameCommandsFactory.CLOSE_AND_SHOW_GAME_CANVAS, displayable);
      } else if (command == gameCommandsFactory.DISPLAY_ABOUT) {
        this.commandAction(gameCommandsFactory.SET_MENU_DISPLAYABLE, this.getAboutCanvas());
      } else if (command == gameCommandsFactory.TOGGLE_KEYBOARD) {
        VirtualKeyboardEventHandler virtualKeyboardEventHandler =
            VirtualKeyboardEventHandler.getInstance();

        virtualKeyboardEventHandler.fireEvent(virtualKeyboardEventHandler.SHOW_EVENT);
      } else if (command.getLabel().compareTo(gameCommandsFactory.TOGGLE_FULLSCREEN.getLabel())
          == 0) {
        MainFeatureFactory mainFeatureFactory = MainFeatureFactory.getInstance();

        Features features = Features.getInstance();

        boolean isFullScreen = features.isFeature(mainFeatureFactory.FULL_SCREEN);

        if (isFullScreen) {
          features.removeDefault(mainFeatureFactory.FULL_SCREEN);
        } else {
          features.addDefault(mainFeatureFactory.FULL_SCREEN);
        }

        this.updateFullScreen();
      }

      // no else
      // if (command != gameCommandsFactory.START_COMMAND && command !=
      // gameCommandsFactory.RESTART_COMMAND)
      // {
      // gameMidletStateFactory.setCurrentGameState(GameState.NO_GAME_STATE);
      // }

    } catch (Exception e) {
      LogUtil.put(
          LogFactory.getInstance(
              CommonStrings.getInstance().EXCEPTION,
              this,
              MidletStrings.getInstance().COMMAND_ACTION,
              e));
      if (command != GameCommandsFactory.getInstance().EXIT_COMMAND) {
        this.exit(false);
      }
    }
  }