Namespaces
Variants
Actions

How to create a quick Options Menu in Java ME

Jump to: navigation, search
SignpostIcon Asha UI.png
Article Metadata

Article
Created: firt (15 Apr 2007)
Last edited: hamishwillee (18 Jul 2012)

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 LCUI 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};
menu.setSelectedFlags(options);
 
ok = new Command("Save", Command.OK, 1);
menu.addCommand(ok);
menu.setCommandListener(this);

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 18 July 2012, at 08:54.
114 page views in the last 30 days.
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved