Wild stab in the dark here, but ConcurrentModificationException
happens when you try to alter the contents of a Collection (in this
case some kind of list) when that list is being iterated over.

It kooks like what you're doing is modifying a UI object while the UI
is actually doing some internal processing.

Rather than modify the object directly in the callback, try posting
yourself a message (or a Runnable) that will be executed by the Main
message handler.

Doug

On Jun 26, 3:19 pm, jgostylo <[email protected]> wrote:
> I am trying to integrate a third party location finding service into
> my app and I am using the results of the location to place an overlay
> onto my map.  The answer to this question is not "use
> MyLocationOverlay".  I am moving away from that for non-GPS accuracy
> reasons.
>
> When the third party location callback is executed, I update where
> this overlay is to reflect the new location.  Doing this makes the
> application throw a ConcurrentModificationException.  Here is the full
> stack trace:
>
> ERROR/AndroidRuntime(5440): Uncaught handler: thread main exiting due
> to uncaught exception
> ERROR/AndroidRuntime(5440): java.util.ConcurrentModificationException
> ERROR/AndroidRuntime(5440):     at java.util.AbstractList
> $SimpleListIterator.next(AbstractList.java:66)
> ERROR/AndroidRuntime(5440):     at
> com.google.android.maps.OverlayBundle.draw(OverlayBundle.java:44)
> ERROR/AndroidRuntime(5440):     at
> com.google.android.maps.MapView.onDraw(MapView.java:471)
> ERROR/AndroidRuntime(5440):     at android.view.View.draw(View.java:
> 5838)
> ERROR/AndroidRuntime(5440):     at android.view.ViewGroup.drawChild
> (ViewGroup.java:1486)
> ERROR/AndroidRuntime(5440):     at android.view.ViewGroup.dispatchDraw
> (ViewGroup.java:1228)
> ERROR/AndroidRuntime(5440):     at android.view.ViewGroup.drawChild
> (ViewGroup.java:1484)
> ERROR/AndroidRuntime(5440):     at android.view.ViewGroup.dispatchDraw
> (ViewGroup.java:1228)
> ERROR/AndroidRuntime(5440):     at android.view.View.draw(View.java:
> 5841)
> ERROR/AndroidRuntime(5440):     at android.widget.FrameLayout.draw
> (FrameLayout.java:352)
> ERROR/AndroidRuntime(5440):     at android.view.ViewGroup.drawChild
> (ViewGroup.java:1486)
> ERROR/AndroidRuntime(5440):     at android.view.ViewGroup.dispatchDraw
> (ViewGroup.java:1228)
> ERROR/AndroidRuntime(5440):     at android.view.ViewGroup.drawChild
> (ViewGroup.java:1484)
> ERROR/AndroidRuntime(5440):     at android.view.ViewGroup.dispatchDraw
> (ViewGroup.java:1228)
> ERROR/AndroidRuntime(5440):     at android.view.View.draw(View.java:
> 5841)
> ERROR/AndroidRuntime(5440):     at android.widget.FrameLayout.draw
> (FrameLayout.java:352)
> ERROR/AndroidRuntime(5440):     at
> com.android.internal.policy.impl.PhoneWindow$DecorView.draw
> (PhoneWindow.java:1847)
> ERROR/AndroidRuntime(5440):     at android.view.ViewRoot.draw
> (ViewRoot.java:1217)
> ERROR/AndroidRuntime(5440):     at
> android.view.ViewRoot.performTraversals(ViewRoot.java:1030)
> ERROR/AndroidRuntime(5440):     at android.view.ViewRoot.handleMessage
> (ViewRoot.java:1482)
> ERROR/AndroidRuntime(5440):     at android.os.Handler.dispatchMessage
> (Handler.java:99)
> ERROR/AndroidRuntime(5440):     at android.os.Looper.loop(Looper.java:
> 123)
> ERROR/AndroidRuntime(5440):     at android.app.ActivityThread.main
> (ActivityThread.java:3948)
> ERROR/AndroidRuntime(5440):     at
> java.lang.reflect.Method.invokeNative(Native Method)
> ERROR/AndroidRuntime(5440):     at java.lang.reflect.Method.invoke
> (Method.java:521)
> ERROR/AndroidRuntime(5440):     at com.android.internal.os.ZygoteInit
> $MethodAndArgsCaller.run(ZygoteInit.java:782)
> ERROR/AndroidRuntime(5440):     at
> com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540)
> ERROR/AndroidRuntime(5440):     at dalvik.system.NativeStart.main
> (Native Method)
>
> I am assuming that this third party callback is not executed in a safe
> way.  Is there a paradigm I should follow to make sure that this is
> executed safely?  For instance, does anyone know what
> MyLocationOverlay does to make sure its callback is executed safely
> for updating the overlay?  I could not find source for
> MyLocationOverlay.
--~--~---------~--~----~------------~-------~--~----~
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