I am getting the following exception:

12-24 00:29:25.922: ERROR/AndroidRuntime(267): Uncaught handler:
thread main exiting due to uncaught exception
12-24 00:29:25.960: ERROR/AndroidRuntime(267):
java.util.ConcurrentModificationException
12-24 00:29:25.960: ERROR/AndroidRuntime(267):     at
java.util.AbstractList$SimpleListIterator.next(AbstractList.java:59)
12-24 00:29:25.960: ERROR/AndroidRuntime(267):     at
com.google.android.maps.OverlayBundle.draw(OverlayBundle.java:41)
12-24 00:29:25.960: ERROR/AndroidRuntime(267):     at
com.google.android.maps.MapView.onDraw(MapView.java:454)


I believe this is whats happening:

I have a MapView with a few Map Overlays (simple markers),
occasionally the locations of the markers change so I clear the map
overlays using: "map.getOverlays().clear()" and insert new marker
overlays onto the map.

However, if I happen to be moving the map, or zooming the map when the
update occurs I get the above ConcurrentModificationException.

I tried synchronizing on the map overlay list, like:
synchronized (map.getOverlays()) {
  // clear and update overlays
}

However I still get the above exception.

Can someone explain the correct way to clear overlays on a map and to
repopulate them without encountering ConcurrentModification
Exceptions.

Oh and I am calling: "map.postInvalidate()" to "refresh" the map and
display the changes made to the overlays. Is this the correct way to
"repaint" a map?

Thanks
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to