Java ME record store problem -
i save data record store. if aplication running works fine, when restart aplication data in record store lost.
here load command:
try { int i=1; display.setcurrent(list2); recordstore rs = recordstore.openrecordstore("recordstore", true); recordenumeration re= rs.enumeraterecords(null, null, true); adresaurl ad = new adresaurl(); system.out.println("nacteno"); while(re.hasnextelement()){ byte br[] = rs.getrecord(i); ad.setpopis(new string(br)); br = rs.getrecord(i+1); ad.seturl(new string(br)); system.out.println(ad.getpopis()); system.out.println(ad.geturl()); i+=2; adresy.addelement(ad); list2.append(ad.getpopis(), null); system.out.println("nacteno2"); } recordstore.closerecordstore(); } catch (exception e) { }
yeah won't work.
if use recordenumeration
iterate through rms (as are), must use recordenumeration.nextrecord()
retrieve record data. using recordstore.getrecord()
.
recordenumeration.nextrecord()
advances recordenumeration
on one. never call it, loop:
while (re.hasnextelement()) { ... }
will never end!
Comments
Post a Comment