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: 178
Registered: ‎11-19-2008
My Device: Not Specified
Accepted Solution

Question about RuntimeStore

I've a question regarding RuntimeStore.

The API documentation says it is "a central location for applications to share information". But does this mean that there are no cached instances of the objects stored there?

For example:



Integer i = new Integer(0);
RuntimeStore.getInstance().put(ID, i);

//On other module:
Integer i = (Integer) RuntimeStore.getInstance().get(ID);



What will be the value of i? It is necesary to call replace after each modification of the object in order to be inmediately visible to other modules?


And if I have my own cached Integer, is that object refreshed when some other module alters it, withouth having to call  getInstance().get(ID)?



Posts: 1,807
Registered: ‎04-28-2009
My Device: Z10 (STL100-4)-, Z10 (STL100-3)-, Z30 (STA100-5)-, Passport (SQW100-1)-, PlayBook (16GB)-
My Carrier: Verizon

Re: Question about RuntimeStore

"i" will be 7. RuntimeStore keeps references to the object so if you modify the reference, other applications will see the changes. replace would be to change the object, such as from Integer to Float. At least that is from my experence.

---Spends time in #blackberrydev on freenode (IRC)----
Three simple rules:
1. Please use the search bar before making new posts.
2. "Like" posts that you find helpful.
3. If a solution has been found for your post, mark it as solved.
--I code too much. Well, too bad.
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Question about RuntimeStore

Agree with rcmaniac25 and just to add a little.


Each Application will get a reference to the Object, so they will all see the same Object,  Thus updates will be seen by all.  If you create a new Object and replace, then the Object is no longer shared.  Everyone will have to get the reference from RuntimeStore again.

Posts: 178
Registered: ‎11-19-2008
My Device: Not Specified

Re: Question about RuntimeStore

I see. So RuntimeStore must be something like a shared area of RAM.

Thanks, peter and rcmaniac25.