public void commandAction(Command command, Displayable displayable) { display.setCurrent(parentView); if (command == cmdSelect) { setString(list.getString(list.getSelectedIndex())); } if (command == cmdClear) { recentList.removeAllElements(); saveRecentList(); } }
public String getString() { String result = super.getString(); int i = 0; if (result.length() == 0) return result; while (i < recentList.size()) { if (result.equals((String) recentList.elementAt(i)) || i > 9) recentList.removeElementAt(i); else i++; } recentList.insertElementAt(result, 0); saveRecentList(); return result; }