Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Trusted Contributor
arun_kumar
Posts: 123
Registered: ‎09-03-2010
My Device: Blackberry 9000
My Carrier: Airtel

storing and retrieving data's in blackberry

[ Edited ]

I have a list field which contains questions in the first screen and i am passing the selected index of the list to the second screen i am parsing JSON according to the question id. I am parsing the answers for the questions. The question will be 2 types such as single answer and multiple answer. I am displaying a array of Radio button field for single answers and a array of Checkbox field for multiple answers. Now if the user selects the answer, i need to store it temporarily and i should show him the answer which he selected when he selects the same question. I don't have idea in this. can any one guide me in this ?? I want to try with  sqlite ?? how to do ??

Please use plain text.
Developer
peter_strange
Posts: 19,595
Registered: ‎07-14-2008
My Device: Not Specified

Re: storing and retrieving data's in blackberry

Do you need to permanently store this data?  if the device has restarted will the user expect the data to still be there?

 

If not just store the answers in a data object that is retained by your Application.

 

If persistence is required, then try this tutorial.  You will find other informaiton if you search for persistent. 

http://supportforums.blackberry.com/t5/Java-Development/Storing-Persistent-Data/ta-p/442785

Please use plain text.
Trusted Contributor
arun_kumar
Posts: 123
Registered: ‎09-03-2010
My Device: Blackberry 9000
My Carrier: Airtel

Re: storing and retrieving data's in blackberry

No peter. I don't want to store the data's permanently.. If the user clicks submit button, i will pass the question id and answer id's in server and i will erase the data's for entering new data's. If the user dint click submit button means the data's should be stored temporally if the app is closed also... can you elaborate me the way little more ?
Please use plain text.
Developer
peter_strange
Posts: 19,595
Registered: ‎07-14-2008
My Device: Not Specified

Re: storing and retrieving data's in blackberry

While you could use RMS or SQL to do this, I think the easiest option is either PersistentStore or RuntimeStore.  The choice of these will depend on whether you want the data to survive a device restart - battery out or app install type restart, not just the normal 'standby' power down.  if you want the data to survive the device restart, then you will need to use PersistentStore.  If not, RuntimeStore.  The article I linked you to explains both I think. 

Please use plain text.
Trusted Contributor
arun_kumar
Posts: 123
Registered: ‎09-03-2010
My Device: Blackberry 9000
My Carrier: Airtel

Re: storing and retrieving data's in blackberry

Thanks all. I have figured out with sqlite db. Solved my requirement.

Please use plain text.
Developer
peter_strange
Posts: 19,595
Registered: ‎07-14-2008
My Device: Not Specified

Re: storing and retrieving data's in blackberry

Good oh,  Can you mark this as solved then?  Instrucitons in Help link near top if you need them.

Please use plain text.