My Imageview
is in Grid Layout I have a ontouchlisteners when I Touch the imageview I set it in Invisible and I have a DragListener when I Drop the Imageview the
Error(ConcurrentModificationException)
is appears I want to do is when I drop the Imageview the Imageview
I Touch is set to Visible again.
How can I make this work ?
this is my codes
@Override
public boolean onDrag(View v, DragEvent event) {
int dragEvent = event.getAction();
final View views = (View)event.getLocalState();
switch (dragEvent) {
case DragEvent.ACTION_DRAG_ENTERED:
break;
case DragEvent.ACTION_DRAG_EXITED:
break;
case DragEvent.ACTION_DROP:
views.setVisibility(View.VISIBLE);
break;
case DragEvent.ACTION_DRAG_ENDED:
views.setVisibility(View.VISIBLE);
break;
}
return true;
}
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) {
ClipData data = ClipData.newPlainText("", "");
View.DragShadowBuilder myshadowBuilder = new View.DragShadowBuilder(view);
view.startDrag(data, myshadowBuilder, view, 0);
view.setVisibility(View.INVISIBLE);
return true;
} else {
return false;
}
}