Development Guide
SortedReadableList.doAdd(((Country)countries.elementAt(i)).getCountryName
()) ;
16. To update the list of selectable text items, invoke KeywordFilterField.updateList().
_keywordField.updateList();
17. To obtain the key word that a BlackBerry device user typed into the KeywordFilterField, invoke
KeywordFilterField.getKeyword().
String userTypedWord = _keywordField.getKeyword();
Create a check box
1.
Import the net.rim.device.api.ui.component.CheckboxField class.
2.
Create an instance of a CheckboxField.
CheckboxField myCheckbox = new CheckboxField("First checkbox", true);
Create a radio button
1.
Import the following classes:
• net.rim.device.api.ui.component.RadioButtonGroup
• net.rim.device.api.ui.component.RadioButtonField
2.
Create an instance of a RadioButtonGroup.
RadioButtonGroup rbGroup = new RadioButtonGroup();
3.
Create an instance of a RadioButtonField for each option you want to make available to the BlackBerry® device
user.
RadioButtonField rbField2 = new RadioButtonField("Second field");
4.
Invoke RadioButtonGroup.add() to add the RadioButtonFields to the RadioButtonGroup and
make sure the BlackBerry device user can select only one option at a time.
rbGroup.add(rbField);
rbGroup.add(rbField2);
Create a date field
1.
Import the net.rim.device.api.ui.component.DateField class.
2.
Create an instance of a DateField, providing the value returned by System.currentTimeMillis() as a
parameter to return the current time.
DateField dateField = new DateField("Date: ",System.currentTimeMillis(),
DateField.DATE_TIME);
UI components
19