record store in j2me

939 views Asked by At

I have 2 forms and the data should be stored in the record store only after filling all the fields in both the forms and if we switch from one form to another the fields in the form should contain whatever the user has entered. So how do I store the previous data and auto populate it when he switches from one form to another?

3

There are 3 answers

0
Shai Almog On

You need to indicate whether you are actually using LWUIT manually to build the form or using the GUI builder. Also the answer for 1.4 differs from the answer to 1.5. If you are using LWUIT 1.5 just use LWUIT4IO's Storage classe's writeObject method. Create an object that implements the com.sun.lwuit.io.Externalizable interface and contains your data. You will need to register it using the LWUIT4IO Util class. There is a sample for serializing data within the Tipster demo in LWUIT, it stores hardcoded and modified data into storage.

If you are using 1.4 just go over the RMS API. Not the most intuitive API in the world but usable for storing data.

0
bharath On

You can get the values from RecordStore and populate that values into another Form. Look on the following article for how to read/write/update the record's into RecordStore.

0
Lucifer On

you can have one public DataObject Class. Now Create getter & setter public method in it and access them from anywhere in the project.