Re: [codenameone-discussions] Re: how to avoid ConcurrentModificationException when threads add elements to the UI

2018-08-13 Thread Steve Hannah
One way to resolve this problem by making your MapLayout's layoutContainer() method resilient to re-entry. E.g. private boolean inLayout; public void layoutContainer(Container c) { if (inLayout) { return; } inLayout = true; try { ... the current body of your

[codenameone-discussions] Re: how to avoid ConcurrentModificationException when threads add elements to the UI

2018-08-12 Thread Thomas
I don't think that the current cn1 native map implementation has an asynchronous version of functions for transforming screen position from/to geo position. Anyway, there is something I am not sure to understand in how CN1 invokeAndBlock works. I thought that with an invokeAndBlock call, the w

[codenameone-discussions] Re: how to avoid ConcurrentModificationException when threads add elements to the UI

2018-08-12 Thread Shai Almog
You will notice in the stack trace several calls to calcScreenPosition which trigger native synchronous calls and effectively call a deep nest of invokeAndBlock. What happens is this: - You ask for screen coordinates - Map cn1lib goes into Android and asks for this but because this needs to run

[codenameone-discussions] Re: how to avoid ConcurrentModificationException when threads add elements to the UI

2018-08-12 Thread Thomas
D/MyApplication(24672): [EDT] 0:0:13,103 - Exception: java.util.ConcurrentModificationException - null W/System.err(24672): java.util.ConcurrentModificationException W/System.err(24672):at java.util.ArrayList$ArrayListIterator.next(ArrayList.java:573) W/System.err(24672):at org.tbdlab.my

[codenameone-discussions] Re: how to avoid ConcurrentModificationException when threads add elements to the UI

2018-08-11 Thread Shai Almog
callSerially() should work. I'm guessing the map does some weird things to synchronize with the native layer when manipulating the markers. Do you have the stack trace of the concurrent modification exception? -- You received this message because you are subscribed to the Google Groups "Codena