Troubleshooting guide

72
BlackBerry Java Development Environment Development Guide
public void run() {
RestaurantInfo info = new RestaurantInfo();
info.setElement(RestaurantInfo.NAME, namefield.getText());
info.setElement(RestaurantInfo.ADDRESS, addressfield.getText());
info.setElement(RestaurantInfo.PHONE, phonefield.getText());
info.setElement(RestaurantInfo.WEBSITE, phonefield.getText());
info.setElement(RestaurantInfo.SPECIALTY,
specialtyfield.getText());
_data.addElement(info);
synchronized(store) {
store.setContents(_data);
store.commit();
}
Dialog.inform(_resources.getString(APP_SUCCESS));
namefield.setText(null);
addressfield.setText(null);
phonefield.setText(““);
websitefield.setText(““);
specialtyfield.setText(““);
}
};
private MenuItem getItem = new MenuItem(_resources.getString(MENUITEM_GET), 110, 11) {
public void run() {
synchronized(store) {
_data = (Vector)store.getContents();
if (!_data.isEmpty()) {
RestaurantInfo info = (RestaurantInfo)_data.lastElement();
namefield.setText(info.getElement(RestaurantInfo.NAME));
addressfield.setText(info.getElement(RestaurantInfo.ADDRESS));
phonefield.setText(info.getElement(RestaurantInfo.PHONE));
websitefield.setText(info.getElement(RestaurantInfo.WEBSITE));
specialtyfield.setText(info.getElement(RestaurantInfo.SPECIALTY));
}
}
}
};
private MenuItem phoneItem = new MenuItem(_resources.getString(MENUITEM_PHONE), 110,
12) {
public void run() {
synchronized(store) {
String phoneNumber = phonefield.getText();
if ( phoneNumber.length() == 0) {
Dialog.alert(_resources.getString(ALERT_NO_PHONENUMBER));
} else {
PhoneArguments call = new PhoneArguments(PhoneArguments.ARG_CALL,
phoneNumber);
Invoke.invokeApplication(Invoke.APP_TYPE_PHONE, call);
}
}
}
};
private MenuItem browserItem = new MenuItem(_resources.getString(MENUITEM_BROWSER),
110, 12) {