Troubleshooting guide

68
BlackBerry Java Development Environment Development Guide
private AutoTextEditField currentusernamefield;
private AutoTextEditField currentpasswordfield;
static {
_resources = ResourceBundle.getBundle(
UserInfoResource.BUNDLE_ID, UserInfoResource.BUNDLE_NAME);
store = PersistentStore.getPersistentObject(0xa1a569278238dad2L);
}
private MenuItem saveItem = new MenuItem( _resources.getString(MENUITEM_SAVE), 110, 10)
{
public void run() {
String username = usernamefield.getText();
String password = passwordfield.getText();
String[] userinfo = {username, password};
synchronized(store) {
store.setContents(userinfo);
store.commit();
}
Dialog.inform(_resources.getString(APP_SUCCESS));
usernamefield.setText(null);
passwordfield.setText(null);
}
};
private MenuItem getItem = new MenuItem( _resources.getString(MENUITEM_GET), 110, 11 )
{
public void run() {
synchronized(store) {
String[] currentinfo = (String[])store.getContents();
if(currentinfo == null) {
Dialog.alert(_resources.getString(APP_ERROR));
} else {
currentusernamefield.setText(currentinfo[0]);
currentpasswordfield.setText(currentinfo[1]);
}
}
}
};
public static void main(String[] args) {
UserInfo app = new UserInfo();
app.enterEventDispatcher();
}
public UserInfo() {
MainScreen mainScreen = new UserMainScreen();
mainScreen.setTitle(new LabelField(
_resources.getString(APPLICATION_TITLE)));
usernamefield = new AutoTextEditField(
_resources.getString(FIELD_NAME), ““);
passwordfield = new PasswordEditField(
_resources.getString(FIELD_PASSWORD), ““);
currentusernamefield = new AutoTextEditField(
_resources.getString(FIELD_CURRENTNAME), ““);