0

I have added all lat/lng to arraylist and .Iwould like to map it to string name and another string along with its id which is an int .Basically I would like to get :

Association : (arraylist)-->Name---->Another Name------>id

how do I do the above association.I am a noob in android and I am using hashmap but it only puts(key,value) which does not satisfy the above condition.

Please let me know how I can implement the above requirement. I appreciate any help. Thanks in Advance.

4

1 回答 1

1

There are a number of ways you could accomplish this. Here are two different ways off the top of my head:

Create an object that will hold the two names and id. Then create a hashmap that maps each lat/long value to the appropriate object. The prototype would be like:

HashMap<Long/Lat, Object>

Or if you don't want to create a new object, then create a hashmap that maps each lat/long value to a hashmap that contains the two names and id. The prototype would be like:

HashMap<Long/Lat, HashMap<String, String>>
于 2013-10-06T07:49:07.440 回答