0
Good evening, I am developing an application containing several buttons, in which you can drag a button and drop in a certain place already defined in the application, and each button has to open another screen with an animated image (GIF) different, but that has to do with the dragged button, how to set the image for each button? And what to call it? It follows below the piece of code I’m having difficulty.
View.Onlongclicklistener longClickListener = new View.Onlongclicklistener() {
public boolean onLongClick(View v) {
ClipData data = ClipData.newPlainText("","");
View.DragShadowBuilder myShadowBuilder = new View.DragShadowBuilder(v);
v.startDrag(data, myShadowBuilder, v, 0);
return true;
}
};
View.OnDragListener dragListener = new View.OnDragListener() {
@Override
public boolean onDrag(View v, DragEvent event) {
int dragEvent = event.getAction();
switch (dragEvent){
case DragEvent.ACTION_DRAG_ENTERED:
break;
case DragEvent.ACTION_DRAG_EXITED:
break;
case DragEvent.ACTION_DROP:
final View view = (View) event.getLocalState();
if(view.getId() == R.id.btA){
Intent TelaBoca = new Intent(TelaAprendizagem.this, TelaFala.class);
startActivity(TelaBoca);
}
break;
}
return true;
}
};