Radio button
Use radio buttons for options that BlackBerry® device users can select from a set of choices. Users can select only one option in each set of radio buttons.
| Class | RadioButtonGroup, RadioButtonField |
| Supported since | BlackBerry® Java® SDK 3.6 |
| Example |
|
For more information about radio buttons, see the UI Guidelines.
Code sample: Creating radio buttons
import net.rim.device.api.ui.*;
import net.rim.device.api.ui.component.*;
import net.rim.device.api.ui.container.*;
public class RadioButtonDemo extends UiApplication
{
public static void main(String[] args)
{
RadioButtonDemo theApp = new RadioButtonDemo();
theApp.enterEventDispatcher();
}
public RadioButtonDemo()
{
pushScreen(new RadioButtonDemoScreen());
}
}
class RadioButtonDemoScreen extends MainScreen
{
public RadioButtonDemoScreen()
{
setTitle("Radio Button Demo");
RadioButtonGroup rbg = new RadioButtonGroup();
add(new RadioButtonField("Option 1",rbg,true));
add(new RadioButtonField("Option 2",rbg,false));
}
}
Next topic: Toolbar
Previous topic: Buttons