Android 2.1 GoogleMaps ItemizedOverlay ConcurrentModificationException

后端 未结 4 1439
情话喂你
情话喂你 2020-12-18 15:51

I cannot figure out the origin of the ConcurrentModificationException. In my activity I\'m calling updateMapOverlay(). I\'m also cal

4条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-18 16:30

    Thank you for your response.

    However, in your code aren't you doing something similar (map.getOverlays().remove(sites); and map.getOverlays().add(sites);)?

    class OverlayTask extends AsyncTask { @Override public void onPreExecute() { if (sites!=null) { map.getOverlays().remove(sites); map.invalidate(); sites=null; } }

     @Override
     public Void doInBackground(Void... unused) {
      SystemClock.sleep(5000); // simulated work
    
     sites=new SitesOverlay();
    
     return(null);
    

    }

    @Override
    public void onPostExecute(Void unused) {
      map.getOverlays().add(sites);
      map.invalidate();
     }
    }
    

提交回复
热议问题