אנדרואיד drag and drop.

אנדרואיד drag and drop.

אני מנסה לעשות drag and drop. זה עובד בסדר אבל אני אוצה שכשהאובייקט ייעזב, תתבצכ בדיקה אם הוא נפל על אובייקט ספציפי אחר.
איך ניתן לעשות זאת?
זה הקוד שעשיתי עד כה



@Override
public boolean onTouch(View view, MotionEvent me) {
if (me.getAction() == MotionEvent.ACTION_DOWN) {
status = START_DRAGGING;


}
if (me.getAction() == MotionEvent.ACTION_UP) {
status = STOP_DRAGGING;
Log.i("Drag", "Stopped Dragging");
} else if (me.getAction() == MotionEvent.ACTION_MOVE) {
if (status == START_DRAGGING) {
System.out.println("Dragging");

LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(
50, 50);
layoutParams.setMargins((int) me.getRawX() - 25,
(int) me.getRawY() - 50, 0, 0);

LinearLayout layout = (LinearLayout) findViewById(R.id.ll_first);
layout.removeView(btn);
layout.addView(btn, layoutParams);

btn.invalidate();
}
}
return false;
}
 
למעלה