Choice field: text-based drop-down list

Use a text-based drop-down list for text-based options that BlackBerry device users can select from a list. Users can select only one option at a time.

Class

ObjectChoiceField

Supported since

BlackBerry Java SDK 5.0

More information

For more information about text-based drop-down lists, see the UI Guidelines.

Example

This screen shows a text-based drop-down list.

import net.rim.device.api.ui.*;
import net.rim.device.api.ui.component.*;
import net.rim.device.api.ui.container.*;

public class TextDropdownListDemo extends UiApplication 
{ 
    public static void main(String[] args) 
    { 
        TextDropdownListDemo theApp = new TextDropdownListDemo(); 
        theApp.enterEventDispatcher(); 
    } 
    public TextDropdownListDemo() 
    { 
        pushScreen(new TextDropdownListDemoScreen()); 
    } 
}
class TextDropdownListDemoScreen extends MainScreen 
{
    public TextDropdownListDemoScreen() 
    {
        setTitle("Drop-down List Demo"); 
        String choices[] = 
           {"Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"};
        int iSetTo = 2;
        add(new ObjectChoiceField("Day of the week",choices,iSetTo));
    }
}