×

PopupChoiceGroup

The PopupChoiceGroup is a LWUIT component. It is similar to the platform ChoicePicker. As it extends Container, you can create an instance of PopupChoiceGroup and add it on to a Form.

PopupChoiceGroup has two implementations:

  • Single selection ChoicePicker

    This is used to provide the platform look and feel to the MIDlet, and as a replacement for the ComboBox.

  • Multiple selection ChoicePicker

    This is used for allowing selection of multiple items from a list.

The PopupChoiceGroup component opens up to show selectable items when the user presses the component.

Figure 1. PopupChoiceGroup in a MIDlet

Implementation

  1. Create a String of array.

    String[] choices = new String[] {"Option item 1", "Option item 2", "Option item 3"};
  2. Create an instance for PopupChoiceGroup and add it to Form.

    single = new PopupChoiceGroup("Single ChoicePicker", null, choices, PopupChoiceGroup.SINGLE);
    myForm.addComponent(single);
Note:

For creating a single ChoicePicker, pass the type as PopupChoiceGroup.SINGLE and for creating a multi ChoicePicker, pass the type as PopupChoiceGroup.MULTIPLE. This will show the list of selectable items from where the user can select the item. Use PopupChoiceGroup.getSelectedItem() and PopupChoiceGroup.getSelectedIndex() to know which item was selected from the PopupChoiceGroup.


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.

×