Hi, the exception seems like a bug. We'll have to look into that (please file an issue). Isn't the camera movement due to the call setCameraPosition, in your code?
On Wednesday, January 27, 2021 at 10:02:21 PM UTC+2 [email protected] wrote: > Hi, > > In my app I show on a map the current position of the user who operates > the device. > > The map is in a Singleton form and successfully shows the pin on the map, > but when I scroll the map it shows the error message: "An internal > application error occurred: java.Util.CurrentModificationException". > > On the console it displays the following message: > > java.util.ConcurrentModificationException > at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:907) > at java.util.ArrayList$Itr.next(ArrayList.java:857) > at com.codename1.googlemaps.MapLayout$1.run(MapLayout.java:320) > at com.codename1.ui.Display.processSerialCalls(Display.java:1338) > at com.codename1.ui.Display.edtLoopImpl(Display.java:1280) > at com.codename1.ui.Display.mainEDTLoop(Display.java:1162) > at com.codename1.ui.RunnableWrapper.run(RunnableWrapper.java:120) > at com.codename1.impl.CodenameOneThread.run(CodenameOneThread.java:176) > > My code: > > Visita v = new Visita(); > ArrayList aVisita = consultaTablas(v, VISITA); > for (Object cmp : aVisita) { > v = (Visita) cmp; > Cliente c = consultaRegistroCliente(v.clienteId.get()); > cr = new Coord(v.latitud.get(), v.longitud.get()); > EncodedImage enc = null; > switch (v.estado.get()) { > case PENDIENTE: > enc = EncodedImage.createFromImage(iPendiente, false); > break; > case INICIADO: > enc = EncodedImage.createFromImage(iIniciado, false); > break; > case COMPLETADO: > enc = EncodedImage.createFromImage(iCompletado, false); > break; > } > mc.addMarker(enc, > cr, > c.nombre.get(), > c.direccion.get(), > e -> { > ToastBar.showMessage(c.nombre.get() + " " + > c.direccion.get(), FontImage.MATERIAL_PLACE); > }); > } > > LocalizacionService.bind(pos -> { > > Label lbUsuario = new Label(); > lbUsuario.setMaterialIcon(FontImage.MATERIAL_PLACE, > Display.getInstance().convertToPixels(0.09f)); > Coord c = new Coord(pos.latitud.get(), pos.longitud.get()); > mc.addMarker(lbUsuario, c); > mc.setCameraPosition(c); > try { > pos.latitud.addChangeListener(p -> { > Coord crd = mc.getCameraPosition(); > if (crd.getLatitude() != pos.latitud.get()) { > lbUsuario.remove(); > mc.addMarker(lbUsuario, new > Coord(pos.latitud.get(), pos.longitud.get())); > lbUsuario.animate(); > } > }); > > pos.longitud.addChangeListener(p -> { > Coord crd = mc.getCameraPosition(); > if (crd.getLongitude() != pos.longitud.get()) { > lbUsuario.remove(); > mc.addMarker(lbUsuario, new > Coord(pos.latitud.get(), pos.longitud.get())); > lbUsuario.animate(); > } > }); > } catch (Exception err) { > // this isn't likely as this is a RAM based stream > Log.e(err); > Dialog.show("Error", err.getMessage(), "continuar", null); > } > }, loc -> { > > }); > > Another important thing is that every time I delete and create the pin the > map is centered based on its new position. I don't understand why it does > it if I'm not using the setCameraPosition. > > Thanks > > -- You received this message because you are subscribed to the Google Groups "CodenameOne Discussions" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/codenameone-discussions/374c52c6-b805-4ce7-b6ee-0d31c51a8b8dn%40googlegroups.com.
