Skip to content Skip to sidebar Skip to footer

Async Task Throw Concurrent Modification Exception?

I am calling AsyncTask on zoom-in and zoom-out of google map after zoom-in or zoom-out we are calling this methos as:- public void doListing(String URL) { mapView.getOverlays(

Solution 1:

You can change all methods of your class Mapdatatask to synchronized method, then try out.

For example from

protected Integer doInBackground(Void... params) {
....    
}

To

protectedsynchronized Integer doInBackground(Void... params){
....    
}

Do the same for all methods and check again. :)

Solution 2:

If you call currenttask.cancel(true); you also must check isCancelled() in doInBackground() method and stop method execution.

And even if you stop prewous task you need sync access to you list. See other answers!

Post a Comment for "Async Task Throw Concurrent Modification Exception?"