07-16-2008 10:34 AM
Solved! Go to Solution.
07-16-2008 10:46 AM
Using the PersistentStore will meet your requirements here. Please take a look at the memorydemo that ships with the JDE for best practices when using these classes.
The sample app can be found here:
C:\Program Files\Research In Motion\BlackBerry JDE 4.2.1\samples\com\rim\samples\device\memorydemo
07-16-2008 11:13 AM
Yes, I that was what I was using. I found that whenever I exitted the application, my clean up method gets called and I call the destroyPersistentObject method in it. I removed the line and it appears to be working fine now.
Question though, I want that object to be there for as long as the application is installed, but what will happen to the object if/when my app is removed? How will it be cleaned up/removed? Will it be cleaned up implicitly or will I need to explicitly destroy it before uninstall? If it's the latter, how would I go about doing it?
07-16-2008 11:30 AM
To ensure that your PersistentStore object is removed when your application is removed you need to make sure that root object of your PersistentStore (the object passed into your call to setContent()) is defined within the package of your application.
For example, instead of using a Hashtable as the root object you can use MyHashtable which is a class defined in your package that simply extends Hashtable. This tells the VM that no one else on the device will use this class once your application is removed so it will delete your PersistentStore object.
If you would like your data to remain on the device after your application is removed then you would want to leverage a system class (like Hashtable) since it could be used across any other application.
10-03-2008 12:55 PM
what are the variables we can store in a single persistent object?
i know we can store String. is it possible to store Date and other fields in the same persistent object?
currently i'm converting all my datas to string and storing it in the persistent object. is it possible to store int as int and date as date?...
10-03-2008 04:33 PM - edited 10-06-2008 10:06 AM
10-06-2008 10:07 AM