public void commandAction(Command command, Displayable display) { if (command == javax.microedition.lcdui.List.SELECT_COMMAND) { // View this verse // Grab the reference int selectedIndex = getSelectedIndex(); if (selectedIndex != -1) { // Convert to cyclic history list selectedIndex += goBible.historyStartIndex; if (selectedIndex >= GoBible.HISTORY_SIZE) { selectedIndex -= GoBible.HISTORY_SIZE; } goBible.currentBookIndex = goBible.historyVerseIndices[selectedIndex * 3] & 0xff; goBible.currentChapterIndex = goBible.historyVerseIndices[selectedIndex * 3 + 1] & 0xff; goBible.currentVerseIndex = goBible.historyVerseIndices[selectedIndex * 3 + 2] & 0xff; goBible.bibleCanvas.enterLoadingMode(); goBible.display.setCurrent(goBible.bibleCanvas); goBible.loadCurrentChapter(); goBible.bibleCanvas.update(); } } else { switch (command.getCommandType()) { case Command.OK: case Command.CANCEL: { // Revert to the previously displayed verse goBible.bibleCanvas.enterLoadingMode(); goBible.display.setCurrent(goBible.bibleCanvas); goBible.bibleCanvas.repaint(); goBible.loadCurrentChapter(); goBible.showMainScreen(); break; } } } }