1

我正在开发一个在 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
}
4

1 回答 1

0

为什么不尝试使用 Storage 类?是lwuit中RMS的演变吗

于 2013-02-05T00:47:53.293 回答