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
Posts: 248
Registered: ‎11-23-2009
My Device: Not Specified
Accepted Solution

Insert Objects into Vector in j2me

Hi,

 

I am not sure if this is the right forum for queries exclusive to j2me. But i am hoping someone can help me with this......

 

Actually i have a while loop within which i create an custom object and assign values to its attributes. At the end of each iteration i wish to add this object to a vector object. I use addElement() for this.

 

The problem i am facing is when i insert the 2nd object to the vector, the attribute values of the first one are lost and instead the attributes of both the objects in my vector have same values .i.e. value of the 2nd entry........

 

Firstly i would like to know if vector supports complex data types. If yes then can anyone tell me how to insert them into vector?

 

Thanks in advance,

Saket 

Developer
Posts: 467
Registered: ‎07-16-2009
My Device: Z10 LE
My Carrier: Vodafone NL

Re: Insert Objects into Vector in j2me

Hi,

 

Can you share code of your complex object? I don't think that it's problem of the Vector. I'm sure that you use static fields and you are rewriting them when you create the second object for vector.

 

Thanks,

Eugen

Developer
Posts: 248
Registered: ‎11-23-2009
My Device: Not Specified

Re: Insert Objects into Vector in j2me

Hi

 

Yes it seems that the problem was due to static field........

 

Thanks Eugen!

Saket