2

Based on this post (Clear markers from Google Map in Android) and in the @Prasad comment "Also note that clear() function won't reset the Marker IDs. Basically you won't get m0 again for new Marker adding."

I have a list of marker saved and i also have implemented a onMarkerClickListener() which shows certain information abut it. The only way that i know i have to "know" and associate the marker with my list of my_objects are the marker_id....but, the problem is when I call GoogleMap.clear() function to reset all the info, (I clear both the Map and the list of markers saved), so when i add new marker the IDs doesn't begin by m0...

My question is, is there a way to reset the markers ID? or do i have a better way to do this marker <-> my_object association?

Thanks

Community
  • 1
  • 1
lienmt
  • 147
  • 8
  • Just a thought. Instead of trying to clear the IDs, is it possible to try remember the last added ID number. Then use this number on your next add marker function ? Just a quick thought to an alternative solution, hop it helps – JustWe May 07 '14 at 22:28
  • yes i can but then what? how i know which marker was selected??? – lienmt May 08 '14 at 08:23
  • well, i finally use the marker.position to know which object "was associated", by computing distance between merker.position and my_object.position....i didn't find another better way since Marker hasn't a setTag() for instance. – lienmt May 09 '14 at 10:03

0 Answers0