我正在开发一个应用程序,它在RMS中存储用户名和密码,应用程序在诺基亚s60上工作正常,但在诺基亚s40手机中,应用程序正在提供IllegalArgumentException,然后应用程序关闭。如果在S60手机上工作正常,我无法理解问题是什么。
public void getLogin() {
//System.out.println(getUsernameEdit().getString()+","+ getPasswordEdit().getString());
m=new Message();
reply=m.getLogin(getUsernameEdit().getString(), getPasswordEdit().getString());
if (reply) {
String response="";
try{
if(count==0){
rs = RecordStore.openRecordStore(db, true);
rs.addRecord("true".getBytes(), 0, "true".length());
rs.addRecord(getUsernameEdit().getString().getBytes(), 0, getUsernameEdit().getString().length());
rs.addRecord(getPasswordEdit().getString().getBytes(), 0, getPasswordEdit().getString().length());
rs.closeRecordStore();
}
else{
rs = RecordStore.openRecordStore(db, false);
byte b[]=rs.getRecord(1);
response=new String(b,0,b.length);
System.out.println(response);
if(response.equals("true")){
rs.setRecord(2, getUsernameEdit().getString().getBytes(), 0, getUsernameEdit().getString().length());
rs.setRecord(3, getPasswordEdit().getString().getBytes(), 0, getPasswordEdit().getString().length());
}
rs.closeRecordStore();
getSenderEdit().setString(getUsernameEdit().getString());
}
}catch(Exception e){
getErrorBox().setString(e.toString());
}
switchDisplayable(getSavingSuccess(), getMessageForm());
// write post-action user code here
} else {
// write pre-action user code here
switchDisplayable(getSavingError(), getSettings());
// write post-action user code here
}
// enter post-if user code here
}
答案 0 :(得分:0)
为什么不尝试使用Storage类?是在lwuit中RMS的演变