czy ponizsze funkcje 1-sza zapisze string do pamici telefonu, 2-ga go zczyta?
pytam bo czasami mi zczytuje inna liczbe niz powinien..
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package tools;
import javax.microedition.rms.*;
/**
*
* @author bart
*/
public class rms {
public static void rmsSave (String _key) {
try {
RecordStore rs = RecordStore.openRecordStore("MyKeys", true);
String appt = _key;
byte bytes[] = appt.getBytes();
rs.addRecord(bytes,0,bytes.length);
rs.closeRecordStore();
} catch (RecordStoreException ex) {
ex.printStackTrace();
}
}
public static String rmsRestore () {
String key = new String();
try {
RecordStore rs = RecordStore.openRecordStore("MyKeys", true);
if (rs.getNumRecords() > 0) {
byte b[] = rs.getRecord(1);
key = new String(b,0,b.length);
rs.closeRecordStore();
}
} catch (RecordStoreException ex) {
ex.printStackTrace();
}
return key;
}
}