1
votes

In my Codename One app that involves (Android) Native interface implementation, I receive on the device from time to time a ConcurrentModificationException which stack trace reads :

W/System.err: java.util.ConcurrentModificationException
W/System.err:     at java.util.ArrayList$ArrayListIterator.next(ArrayList.java:573)
W/System.err:     at com.codename1.impl.android.AndroidAsyncView.flushGraphics(AndroidAsyncView.java:380)
W/System.err:     at com.codename1.impl.android.AndroidImplementation.flushGraphics(AndroidImplementation.java:1147)
W/System.err:     at com.codename1.impl.CodenameOneImplementation.paintDirty(CodenameOneImplementation.java:580)
W/System.err:     at com.codename1.ui.Display.edtLoopImpl(Display.java:1075)
W/System.err:     at com.codename1.ui.Display.mainEDTLoop(Display.java:997)
W/System.err:     at com.codename1.ui.RunnableWrapper.run(RunnableWrapper.java:120)
W/System.err:     at com.codename1.impl.CodenameOneThread$1.run(CodenameOneThread.java:60)
W/System.err:     at java.lang.Thread.run(Thread.java:841)

My code (Codename One part or the native interface implementation) does not use ArrayList andthe app can continue after clicking OK when the 'Internal Error' pops up, but I would prefer to avoid this error.

Where should I look at to prevent this error from happening ?

Any help greatly appreciated,

1

1 Answers

1
votes

That means code is triggering a native repaint for some reason on a separate thread. Does your native code that interacts with the peer component do so using the Android native UI thread?

If not that might trigger a race condition.