Search in sources :

Example 1 with CompoundSpinnerAdapter

use of javax.microedition.lcdui.list.CompoundSpinnerAdapter in project J2ME-Loader by nikita36078.

the class ChoiceGroup method getItemContentView.

@Override
public View getItemContentView() {
    Context context = getOwnerForm().getParentActivity();
    switch(choiceType) {
        case EXCLUSIVE:
            if (buttongroup == null) {
                buttongroup = new RadioGroup(context);
                initButtonGroup();
                ((RadioGroup) buttongroup).setOnCheckedChangeListener(radiolistener);
            }
            return buttongroup;
        case MULTIPLE:
            if (buttongroup == null) {
                buttongroup = new LinearLayout(context);
                initButtonGroup();
            }
            return buttongroup;
        case POPUP:
            if (spinner == null) {
                adapter = new CompoundSpinnerAdapter(context);
                spinner = new Spinner(context);
                spinner.setAdapter(adapter);
                int size = selected.size();
                for (int i = 0; i < size; i++) {
                    adapter.append(strings.get(i), images.get(i));
                }
                if (selectedIndex >= 0 && selectedIndex < selected.size()) {
                    spinner.setSelection(selectedIndex);
                }
                spinner.setOnItemSelectedListener(spinlistener);
            }
            return spinner;
        default:
            throw new InternalError();
    }
}
Also used : Context(android.content.Context) CompoundSpinnerAdapter(javax.microedition.lcdui.list.CompoundSpinnerAdapter) RadioGroup(android.widget.RadioGroup) Spinner(android.widget.Spinner) LinearLayout(android.widget.LinearLayout)

Aggregations

Context (android.content.Context)1 LinearLayout (android.widget.LinearLayout)1 RadioGroup (android.widget.RadioGroup)1 Spinner (android.widget.Spinner)1 CompoundSpinnerAdapter (javax.microedition.lcdui.list.CompoundSpinnerAdapter)1