×
Namespaces

Variants
Actions

How to create ChoiceGroup in LCDUI

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata
Article
Created: senthilkumar05 (26 Dec 2007)
Last edited: hamishwillee (08 Aug 2013)

Needs-update.pngThis 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 8 August 2013, at 04:47.
34 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×