Let me guess... r u invoking your code from *within* your custom MyLocationOverlay code ?
I had the same Java exception as you until I moved my overlay updating code OUT of my custom MyLocationOverlay class. It seems that MyLocationOverlay also maintains a handle on the overlays list, so that appeared(at least for me,) to be the source of the ConcurrentModificationException. On Dec 26, 6:59 pm, mscwd01 <[email protected]> wrote: > Okay, hope everyone had a nice christmas and has had their fill of > Turkey ;) > Now can anyone help me with this? > > On Dec 24, 11:53 am, mscwd01 <[email protected]> wrote: > > > Hello, anyone help me with this please... > > > On Dec 24, 12:42 am,mscwd01<[email protected]> wrote: > > > > 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 aboveConcurrentModificationException. > > > > 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 -~----------~----~----~----~------~----~------~--~---

