12-02-2012 12:58 AM
private void setDataPersistently(Userinfo infoData){
store = PersistentStore.getPersistentObject(0x2562651c36cb
UserInfo info = new UserInfo();
info.setUsername(infoData.getUsername);
info.setPassword(infoData.getPassword);
store.setContents(info);
store.commit();
}
public UserInfo getUserInfo() {
UserInfo userInfo = new UserInfo();
userInfo = (UserInfo)store.getContents();
if(userInfo == null) {
userInfo = new UserInfo();
userInfo.setUsername("");
userInfo.setPassword("");
}
return userInfo;
}
I'm getting null as return value for userInfo.
public class UserInfo implements Persistable {
private String username;
private String password;
public String getUsername() {
return username;
}
public void setUsername(String message) {
this.password = message;
}
public String getPassword() {
return username;
}
public void setPassword(String message) {
this.password = message;
}
}
12-02-2012 06:21 AM
I suspect that store is null when you do the get - I would suggest that you add
store = PersistentStore.getPersistentObject(0x2562651c36cb
before
userInfo = (UserInfo)store.getContents();
Couple of codding things
1) You do not need the
UserInfo userInfo = new UserInfo();
before
userInfo = (UserInfo)store.getContents();
2) Check your setUsername and getPassword methods.