私のAndroidアプリには次のコードがあります:
/**
* callback executed after fetching the data.
*/
public void OnPointsFetch(ArrayList<Shop> result) {
toggleLoader(false);
this.shops = result;
if(activeFilter == Constants.POINTS_FILTER_AVAILABLE){
for(Shop s : result){
if(s.getClientPoints().getPointsAvailable() == 0){
this.shops.remove(s);
}
}
}
else{
for(Shop s : result){
if(s.getClientPoints().getPointsSpent() == 0){
this.shops.remove(s);
}
}
}
ptsListAdapter.setCollection(this.shops);
ptsListAdapter.setFilter(this.activeFilter);
}
このメソッドは、非同期タスクの結果で呼び出されます。リストアダプタに渡す前に、コレクションのいくつかの要素を削除する必要があります。
11-23 17:39:59.760: E/AndroidRuntime(19777): java.util.ConcurrentModificationException
11-23 17:39:59.760: E/AndroidRuntime(19777): at java.util.ArrayList$ArrayListIterator.next(ArrayList.java:569)