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
Developer
arif
Posts: 57
Registered: ‎04-07-2009
My Device: 8300
Accepted Solution

Persistant store problem

Hi I saved an Integer as persistant store. My code is something like this -

Integer encryptedSettings = new Integer(value); synchronized(store) { store.setContents(encryptedSettings); store.commit(); }

 

And I can get this value by using this code

 

store = PersistentStore.getPersistentObject( some_long_value ); int encryptedSettings = 0; if(store != null) { Integer content = (Integer)store.getContents(); if (content != null) { encryptedSettings = content.intValue(); } }

 

 

 

But when I reinstall my application, I want it to be content = null, but it doesn't happen, I got the previous installations stored value in latest installation. How can I resolve this problem. Please help me.

 

 

 

Please use plain text.
Developer
Posts: 5,339
Registered: ‎09-20-2008
My Device: ***
My Carrier: ***

Re: Persistant store problem

[ Edited ]

You need to create a wrapper class to this Integer class instance.

 

For example:

 

class MyWrapper implements Persistable {

    int value;

 

}

 

and store/load this class instance.

 

And in case you are uninstalling the application this class instance will be removed from persistent store.

 

For cases when you store instances built from native java classes (not yours) like Integer, String, Vector directly, they remain in persistent store after uninstall.

 

Use your own classes to compose and store objects and they will be removed.

 


Message Edited by tbilisoft on 07-07-2009 05:58 AM
Please use plain text.
Developer
bikas
Posts: 984
Registered: ‎02-10-2009
My Device: Not Specified
Please use plain text.