• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Tim Cooke
Sheriffs:
  • Rob Spoor
  • Liutauras Vilda
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
  • Piet Souris
Bartenders:
  • Stephan van Hulst

Record store does not remain persistant throughout various openings of MIDLet

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I am using RMS for persistent storage for my J2ME application. I store records in record store, they remain there until i close the application. when i launch application again, the data no more exist. can any one tell what could be the problem?
I also want to store records at run time. Like after installing .jar file in my mobile, i launch the application and there is textfield. User enters word in textfield and it should store in record store and should not get deleted when application is closed.
 
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please post your code so we see what you doing...
 
Imdad Soomro
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
import java.util.Vector;
import javax.microedition.rms.RecordStore;

public class Add {

public void addRec(){
try{
RecordStore recordStore = RecordStore.openRecordStore("words", true );
recordStore.addRecord("a".getBytes(), 0, "Imdad".getBytes().length);
recordStore.addRecord("b".getBytes(), 0, "Asmat".getBytes().length);
recordStore.addRecord("c".getBytes(), 0, "Inam".getBytes().length);
recordStore.addRecord("d".getBytes(), 0, "Ikram".getBytes().length);
recordStore.addRecord("e".getBytes(), 0, "Shafqat".getBytes().length);

recordStore.closeRecordStore();
}catch(Exception e){}

}

public void insert(String str){
try{
RecordStore rs=RecordStore.openRecordStore("words", true);
rs.addRecord(str.getBytes(), 0, str.getBytes().length);
System.out.println("Added user");
}catch(Exception e){}

}

public Vector getRec(){

Vector vt=new Vector();
try{
RecordStore recordst=RecordStore.openRecordStore("words", true);

int u=recordst.getNumRecords();
System.out.print(u);

for(int i=1; i<=recordst.getNumRecords(); i++){
byte br[]=recordst.getRecord(i);
String tr=new String(br);
vt.addElement(tr);
}
}catch(Exception e){}
return vt;
}


}




-------------------------------------------
insert method will be called when user press insert button on a form which has textfield. The value of that text field should store in recordStore. These values should not be deleted when application is closed.
 
Imdad Soomro
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My problem is solved Record Store didn't remain persistent in the J2ME emulator but when i installed the application in mobile, the record store remained persistent. The data remained their no matter how many times i close the application and open again. It created .rms file which stores the data. That file was not visible in mobile but when i see my folders in computer, it also shows the .rms file along with other files.
 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
https://coderanch.com/t/499206/JME/Mobile/ME-record-management-system-concept
 
A lot of people cry when they cut onions. The trick is not to form an emotional bond. This tiny ad told me:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic