Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries. Thanks for all your past and future contributions.

Revision as of 05:07, 8 August 2013 by hamishwillee (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

How to create a quick Options Menu in Java ME

From Wiki
Jump to: navigation, search
Article Metadata
MIDP 2.0
MIDP 1.0
Created: firt (15 Apr 2007)
Last edited: hamishwillee (08 Aug 2013)

It is a "must" feature in a Game or Multimedia applications that the application includes an "Options" menu with some features that the user can enable or disable, like Sound or Vibration.

So, we can use LCDUI API in MIDP 1.0 and MIDP 2.0 to show a List Multiple. That list can be shown in the Display and the user can enable or disable each option of the List.

private List menu;
menu = new List("Game Options", List.MULTIPLE);
menu.append("Music", null);
menu.append("Sound", null);
menu.append("Map", null);
menu.append("OnScreen Help", null);
// We predefine the checked status of each option
boolean[] options = {false, true, false, true};
ok = new Command("Save", Command.OK, 1);

On the commandAction method we should check the menu.getSelectedFlags to fill a boolean array with the status of each option.

This page was last modified on 8 August 2013, at 05:07.
74 page views in the last 30 days.