Drag'n'drop Concurentmodificationexception
OnDragListener: @Override public boolean onDrag(View v, DragEvent event) { switch (event.getAction()) { case DragEvent.ACTION_DRAG_ENTERED: switch (v.getId(
Solution 1:
I found a solution, not to cause an exception you should do next:
public boolean onDrag(View v, DragEvent event) {
switch (event.getAction()) {
case DragEvent.ACTION_DRAG_ENDED:{
v.post(new Runnable{
publicvoidrun() {
//SomeCode;
}
});
break;
}
}
}
Solution 2:
ConcurrentModification Exception occurs while trying to remove item from the list at the same time when iterating the list.
This can be solved using an Iterator.
This is how you can use an iterator :
Iterator<String> it = myArrayList.iterator();
while (it.hasNext()) {
String str = it.next();
if (myCondition)
it.remove();
}
Refer to the flowing links
Java : ConcurrentModificationException while iterating over list
Post a Comment for "Drag'n'drop Concurentmodificationexception"