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
Highlighted
Developer
Posts: 95
Registered: ‎07-24-2013
My Device: 9380
My Carrier: Airtel

Storage

Hi All,

 

   Is there something in blackberry java application development that can be used like "Session" type storage...I just want to ask that when app starts and goes on through first screen..second screen...and i want to store something from first screen or second screen which can be retrieved in 5th or 6th screen and used that value...

 

Thanks and Regards,

Developer
Posts: 354
Registered: ‎06-05-2013
My Device: Blackberry Z10
My Carrier: Vodafone

Re: Storage

you can use static variable for that... or you can store value in Persistent Storage
Developer
Posts: 95
Registered: ‎07-24-2013
My Device: 9380
My Carrier: Airtel

Re: Storage

Hi Aman, First of all Thanks for the reply.

 

  Will static object persist throughout the application...? if yes, How can we use it? Any sample source code help?

 

  PersistentStore will store data still after my application is closed.. isn't it? I don't need this type of storage in my requiremnt... As per my understanding this type of storage can be used where "Remember Me" like checkbox is needed. but for my requirement, i need a storage mechanism which can persist only from start of the app to close of the app...

 


Warm Regards.

Developer
Posts: 354
Registered: ‎06-05-2013
My Device: Blackberry Z10
My Carrier: Vodafone

Re: Storage

you can destroy that persistent object on close of your app
Developer
Posts: 354
Registered: ‎06-05-2013
My Device: Blackberry Z10
My Carrier: Vodafone

Re: Storage

for static:

 

declare like thisin your first main screen

public static String test;

 

initialize it in constructor

 

test = "this is a test string";

 

 

use this test variable in any screen like

System.out.println(firstmainscreenclassname.test);

Developer
Posts: 95
Registered: ‎07-24-2013
My Device: 9380
My Carrier: Airtel

Re: Storage

Ok Aman,

 I've got your point... I think for now it can be used.. let me try it once.. I will let you know..

 

Thanks.

Developer
Posts: 151
Registered: ‎09-28-2012
My Device: Blackberry Developer
My Carrier: Aircel

Re: Storage

static variable is the best way...

 

 


----------------------------------------------------------
Feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.