Tôi có đoạn code folloing trong ứng dụng Android của tôi:java.util.ConcurrentModificationException android sau khi loại bỏ các yếu tố từ danh sách mảng
/**
* 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);
}
Phương pháp này được gọi là trên kết quả của một nhiệm vụ async. Tôi cần phải loại bỏ một số yếu tố của bộ sưu tập trước khi chuyển đến bộ điều hợp danh sách.
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)
Tuyệt vời. nó hoạt động !. – brpaz