Search code examples
androidandroid-maps

Best Way to Add Map Pins to Google Map Android


I have been successful at adding the pins but I need the pins to be refreshed when the user clicks on the map and provides a new location, I get an error. Keep in mind that I need this to happen in the background so that it does not affect the map interaction.

My problem is that when the user clicks on the map the list of map pins is already being updated and I get an ConcurrentModificationException error.

Basically, I have a JSONArray which has locations. I need each location to be on the map and when the new location is touched the pins are updated and the old pins are cleared.

Any suggestions on how to make this more friendly and easier. I cannot seem to get rid of the ConcurrentModificationException error.


Solution

  • Here is the "the missing widget"...

    enter image description here