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. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Java Development

Reply
Developer
kiran_b
Posts: 260
Registered: ‎10-27-2010
Accepted Solution

How to store and retrieve long values in persistent store

Hi,

 

     In my application i want to store and retrieve long values in the persistent store for that i used with Longvector and everything is fine but LongVector is supported from os>=4.6

 

      I need to work my application in 4.5 also , so can any one infrom me what are the other alternatives i have to get my requirement any snippet pls...

Please use plain text.
Developer
sonicboomboy
Posts: 465
Registered: ‎03-04-2009
My Carrier: some

Re: How to store and retrieve long values in persistent store

I would just use plain java.util.Vector
Got resolved! Press kudo icon!
Please use plain text.
Developer
kiran_b
Posts: 260
Registered: ‎10-27-2010

Re: How to store and retrieve long values in persistent store

Hi,

 

    first i used with java.util.vector but after getting value from persistent store to convert string into long  i am getting number format exception...

 

     My requirement is storing a long value and retreiveing a long value..

 

 

Please use plain text.
Developer
sonicboomboy
Posts: 465
Registered: ‎03-04-2009
My Carrier: some

Re: How to store and retrieve long values in persistent store

there's nothing wrong to store long value in Vector.
If you put long number, then retrieve it, why there might be the error?
You should store your values like vector.addElement(new Long(long value));
Got resolved! Press kudo icon!
Please use plain text.
Developer
kiran_b
Posts: 260
Registered: ‎10-27-2010

Re: How to store and retrieve long values in persistent store

then pls,tell me the syntac for retrieving long value from a vector of first element....

 

i need only first element ...

Please use plain text.
Developer
sonicboomboy
Posts: 465
Registered: ‎03-04-2009
My Carrier: some

Re: How to store and retrieve long values in persistent store

Vector v = new Vector();
//fill vector
Long firstElement = (Long) v.firstElement();
long myLong = firstElement.longValue();
Got resolved! Press kudo icon!
Please use plain text.