You cant use setRecord without making the record....
So use addRecord First then when you need to update the record use set record...
here is the code for maintaining only one record in the RMS using the combination of addRecord and setRecord...
try {
rs = RecordStore.openRecordStore("defaultVideoDierctory", true);
if(rs.getNumRecords()>0)
rs.setRecord(1, dir.getBytes(), 0, dir.length());
else
rs.addRecord(dir.getBytes(), 0, dir.length());
Alert a = new Alert("Default Video Folder set:");
a.setString(new String(rs.getRecord(1)));
a.setTimeout(5000);
Display.getDisplay(this).setCurrent(a);
rs.closeRecordStore();
} catch (Exception e) {
//showException("setting video directory", e, menuScreen);
Alert ab = new Alert("Exception");
ab.setString(e.toString());
ab.setTimeout(Alert.FOREVER);
Display.getDisplay(this).setCurrent(ab);
}
No comments:
Post a Comment