I would not use the setRecord method, because it makes problems like you have. I would completely delete the RecordStore, and would write it again (instead of update). I got the same problems you have, when I used setRecord method, and for this reason I completely delete the RecordStore, and create it new.
You should only use 2 methods, writeRS and readRS, for example language settings:
Code:
public void writeRS(String language) {
try {
RecordStore.deleteRecordStore("Language");
RecordStore rs = RecordStore.openRecordStore("Language", true);
rs.addRecord(language.getBytes(), 0, language.getBytes().length);
rs.closeRecordStore();
} catch (RecordStoreException rse) {
rse.printStackTrace();
}
}
public String readRS() {
String language = "English";
try {
RecordStore rs = RecordStore.openRecordStore("Language", true);
if (rs.getNumRecords() == 0) {
rs.addRecord("Language".getBytes(), 0, "Language".getBytes().length);
} else {
language= new String(rs.getRecord(1));
}
rs.closeRecordStore();
} catch (RecordStoreException rse) {
rse.printStackTrace();
}
return language;
}
The standard language is English (first time you start the app e.g.). If you change the language, it will completely delete the RecordStore("Language), and write it again.
AND DANGER:
If you want to get a String from Byte, use: myString = new String(myByte) instead of myString = myByte.toString().
myString = myByte.toString() does not work for me...