How to handle ConcurrentModificationException in Android
Im trying to delete item from a ArrayList. Some times it pops an exception, "java.util.ConcurrentModificationException". First i tried to remove them by array_list_name.remove(i), but it failed and some people were asked to use Iterator instead. So my current code is as follows. for (Iterator<Collectable> iter = array_list_name.iterator(); iter.hasNext();) { Collectable s = iter.next(); if (s.equals(array_list_name.get(id))){ iter.remove(); return true; } } And i call "array_list_name" inside onDraw() function in view. my view is a SurfaceView. Can any one suggest me how to delete items from