Namespaces
Variants
Actions

How to create ChoiceGroup in Java ME

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

Article
Created: senthilkumar05 (26 Dec 2007)
Last edited: hamishwillee (27 Sep 2012)
Needs-update.png
This article needs to be updated: If you found this article useful, please fix the problems below then delete the {{ArticleNeedsUpdate}} template from the article to remove this warning.

Reasons: hamishwillee (27 Sep 2012)
The article has no explanation of what it does other than the heading. It should be extended to state the type of choice group created, display and image and link to reference documentation. It should perhaps be merged with Choice group
import javax.microedition.lcdui.*;
import javax.microedition.midlet.MIDlet;
 
public class ChoiceMidlet extends MIDlet implements CommandListener {
 
Command exit = new Command("Exit", Command.EXIT, 1);
private Display display;
private boolean firsttime;
private Form form;
String[] stringArray = {"Choice A", "Choice B", "Choice C"};
 
public ChoiceMidlet() {}
 
protected void startApp() {
display = Display.getDisplay(this);
form = new Form("Choice Midlet");
 
ChoiceGroup[] groups = {
new ChoiceGroup("Exclusive",
ChoiceGroup.EXCLUSIVE, stringArray,null),
new ChoiceGroup("Multiple",
ChoiceGroup.MULTIPLE, stringArray,null),
new ChoiceGroup("Pop-Up",
ChoiceGroup.POPUP, stringArray,null)
};
for (int i = 0; i < groups.length; i++) {
form.append(groups[i]);
}
form.addCommand(exit);
form.setCommandListener(this);
display.setCurrent(form);
}
 
public void commandAction(Command c, Displayable d) {
if (c == exit) {
destroyApp(false);
notifyDestroyed();
}
}
 
protected void destroyApp(boolean unconditional) {}
 
protected void pauseApp() {}
}
This page was last modified on 27 September 2012, at 09:05.
112 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