Codename One应用程序中的ConcurrentModificationException

时间:2016-12-01 14:24:34

标签: codenameone

在我的Codename One应用程序中涉及(Android)Native接口实现,我不时在设备上收到一个ConcurrentModificationException堆栈跟踪读取:

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)

我的代码(Codename One部分或本机接口实现)不使用ArrayList,当弹出“内部错误”时,单击“确定”后应用程序可以继续,但我宁愿避免此错误。

我应该在哪里查看以防止发生此错误?

非常感谢任何帮助,

1 个答案:

答案 0 :(得分:1)

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.