[android-developers] Re: Synchronizing Maps and Map Overlays - ConcurrentModificationException
Check out this tutorial, it may help with your problem: http://blogoscoped.com/archive/2008-12-15-n14.html Tim --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Synchronizing Maps and Map Overlays - ConcurrentModificationException
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 mscw...@gmail.com 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 mscw...@gmail.com wrote: Hello, anyone help me with this please... On Dec 24, 12:42 am,mscwd01mscw...@gmail.com 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 android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Synchronizing Maps and Map Overlays - ConcurrentModificationException
Peter Wrote: com.google.android.maps.MyLocationOverlay Please note if MyLocationOverlay is a Class in Android Peter DMT wrote: 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 mscw...@gmail.com 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 mscw...@gmail.com wrote: Hello, anyone help me with this please... On Dec 24, 12:42 am,mscwd01mscw...@gmail.com 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 android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Synchronizing Maps and Map Overlays - ConcurrentModificationException
Please stop bumping this, if you're not getting replies it's because people are unable or unwilling to help and bumping will just annoy people. Al. mscwd01 wrote: hmmm, bump. Still havent worked this out. On Dec 26, 11:59 pm, mscwd01 mscw...@gmail.com 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,mscwd01mscw...@gmail.com wrote: Hello, anyone help me with this please... On Dec 24, 12:42 am,mscwd01mscw...@gmail.com 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 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 android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Synchronizing Maps and Map Overlays - ConcurrentModificationException
hmmm, bump. Still havent worked this out. On Dec 26, 11:59 pm, mscwd01 mscw...@gmail.com 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,mscwd01mscw...@gmail.com wrote: Hello, anyone help me with this please... On Dec 24, 12:42 am,mscwd01mscw...@gmail.com 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 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 android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Synchronizing Maps and Map Overlays - ConcurrentModificationException
Hello, anyone help me with this please... On Dec 24, 12:42 am, mscwd01 mscw...@gmail.com 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 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 android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---