Hi, I'm new here, so I hope this is the right section for this topic. I am developing a java application which has to store some files in a Record Store. Everything works fine until I try to write something in this Record Store. I get RecordStoreFullException. The file which I try to write is 75KB and RecordStore.getSizeAvailable() gives me only 65200bytes. When I go to Options>>Status I see that my phone has 45 000 000 bytes (45MB) free. What's happening? How to solve this? Here are the functions which I use. The function "writeToStore" throws the exception!
Code:
RecordStore rs = null;
public void openStore() {
try {
rs = RecordStore.openRecordStore("MileStore", true);
}
catch(Exception error) {
Dialog.alert("Open store: " + error.toString());
}
}
public void closeStore() {
try {
rs.closeRecordStore();
}
catch(Exception error) {
Dialog.alert("Close Store: " + error.toString());
}
}
public int writeToStore(byte[] buf) {
int ret = -1;
try {
ret = rs.addRecord(buf, 0, buf.length);
lfldc.erase();
clear_list();
populate_list();
}
catch(Exception error) {
Dialog.alert("Write to store: " + error.toString());
}
return ret;
}
public void populate_list() {
try {
RecordEnumeration re = rs.enumerateRecords(null,null,false);
int i = 0;
while(re.hasNextElement()) {
lfld.insert(i);
lfldc.insert("Song 1", i);
i++;
}
}
catch(Exception error) {
Dialog.alert("Populate List: " + error.toString());
}
}
public ByteArrayInputStream getItem(int ind) {
ByteArrayInputStream ret = null;
try {
RecordEnumeration re = rs.enumerateRecords(null,null,false);
ret = new ByteArrayInputStream(rs.getRecord(ind));
}
catch(Exception error) {
Dialog.alert("GetItem: " + error.toString());
}
return ret;
}