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

Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Problem in persistent value

[ Edited ]

Are you using the cleaner implementation that Nate posted here:




Whether you are or not, you can not just paste that code into your application and use it.  You have to create a key for the PersistentStore Object first - that gives you the Hashtable.  Then you have to use a key on the Hashtable to get the actual values you are persisting.  So you can't be using the code supplied, you must have tailored it in some way. 


I am getting the impression that you are not sure how to use PersistentStore.  I recommend that you review the KB articles and documentation that is available, including these:








Having reviewed these, I recommend you revisit the example you have found, and see if you understand what it is actually doing. 


I don't use exactly the same approach as suggested by Nate, but it is very similar to it.  The important aspects are:

1) access to the persisted data is managed through one class,

2) the persisted data is managed in a collection rather than a single item, and

3) any class wanting to access some data that is persisted identifies the persisted data it wants by specifying a 'lookup' key.