hi folks, iam having trouble using the method add from ArrayList.
My program consists in parsing and loading information from a xml file containing gps coordinates to memory.
Where 'nd' is a object of a class Nodes. And 'via' from Way class:
So a way its composed of several nodes (if its not a straight line). The problem of the code is that should load a way to the memory, along with its nodes. But for some reason, the add method of ArrayList its only adding the last element of the nodes list.
It looks like you are using the same object repeatedly, instead of creating a new object for each set of data. My guess would be the variable named "nd".
Fernando Piovani
Greenhorn
Joined: Feb 09, 2011
Posts: 10
posted
0
Paul Clapham wrote:It looks like you are using the same object repeatedly, instead of creating a new object for each set of data. My guess would be the variable named "nd".
yeah, i've used nd=new Nodes(); under the .add method and it works. Thanks for poiting that out dude.