ChoicePickerDemo demonstrates how to use PopupChoicePicker and ContextMenu LWUIT Components.


The MIDlet demonstrates the following components.

  • Single ChoicePicker: This shows how you can select a single option from a list of options available.

  • Multiple ChoicePicker: This shows how you can select a multiple options from a list of options available.

  • ContextMenu: This shows how you can add a Context Menu to your application. This demo uses a Show ContextMenu button that displays the various Context Menu options when clicked. The selected menu option is displayed below the Show ContextMenu button.

The MIDlet can be used in both portrait and landscape modes, and is tested on Nokia Asha SDK 1.0.


Initialising LWUIT Display:

Display.init(this); // initialise LWUIT Display

Initialising the form:

Form myForm = new Form("ChoicePickerDemo");

Initialising single choice picker:

single = new PopupChoiceGroup("Single ChoicePicker", null, choices, PopupChoiceGroup.SINGLE);

Initialising multiple choice picker:

if (Display.getInstance().getDeviceType() == Display.ASHA_DEVICE) {
    multiple = new PopupChoiceGroup(" Multi ChoicePicker", info, options, PopupChoiceGroup.MULTIPLE);

Initialising ContextMenu:

Label l = new Label("The button shows the context menu");

show = new Button("Show ContextMenu");

Implementing Context Menu:

ActionListener al = new ActionListener() {
    public void actionPerformed(ActionEvent evt) {
        if (evt.getSource() == show) {
            Command pressedMenuItem = null;
            Command[] cmd = new Command[6];
            cmd[0] = new Command("Menu item one");
            cmd[1] = new Command("Menu item two");
            cmd[2] = new Command("Menu item three");
            cmd[3] = new Command("Menu item four");
            cmd[4] = new Command("Menu item five");
            cmd[5] = new Command("Menu item six");
            pressedMenuItem =, show);

            if (pressedMenuItem != null) {

Displaying the form:;

Last updated 24 June 2013

Back to top

Was this page helpful?

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


Thank you!

We appreciate your feedback.