java - How to solve ConcurrentModificationException in GoogleMaps in Android -
java - How to solve ConcurrentModificationException in GoogleMaps in Android -
i have written code displaying multiple markers in googlemaps in android. code follows.
list<overlay> markerslist; private myitemizedoverlay funplaces; runnable r = new runnable() { public void run() { if (markerslist != null) { mapcontroller mc = mapview.getcontroller(); mc.setzoom(15); (int i=0; < markerslist.size(); i++) { funplaces = (myitemizedoverlay) markerslist.get(i); geopoint pt = funplaces.getcenterpt(); mc.setcenter(pt); mapview.postinvalidate(); } } } }; thread t=new thread(r,"classname"); t.start();
when i'm running above code working fine giving concurrentmodificationexception. how prepare problem? thought appreciated.
if that's you're getting error, you're modifying arraylist while iteration in progress. can't tell code you've provided whether that's due actual concurrency, or performing modifications on arraylist during iteration, that's going reason.
java android
Comments
Post a Comment