0

How to distinguish between Touch and drag in android... I want to create a listview in which people can drag and drop list items,that too with out using a handle... What I have tried and failed is..

case MotionEvent.ACTION_DOWN:
mIsClickX   =   x;
mIsClickY   =   y;

and 

case MotionEvent.ACTION_UP:
if(x == mIsClickX &&y == mIsClickY){
    return super.onTouchEvent(ev);
}

Which doesn't work... Thanks in advance for all your valuable suggestions

Sreekanth Karumanaghat
  • 3,383
  • 6
  • 44
  • 72

2 Answers2

1

MotionEvent.ACTION_MOVE, you can also check:
1- http://www.zdnet.com/blog/burnette/how-to-use-multi-touch-in-android-2/1747
2- Android List View Drag and Drop sort

Community
  • 1
  • 1
Nermeen
  • 15,883
  • 5
  • 59
  • 72
  • Well, I am using the library in a link you just specified(https://github.com/bauerca/drag-sort-listview). But that includes a handler(An Image) which when clicked and dragged causes the list view elements to move around. I don't want that Image. – Sreekanth Karumanaghat Jul 10 '12 at 09:19
1

I think you can try this one.

A drag gesture starts when the first finger is pressed to the screen (ACTION_DOWN) and ends when it is removed (ACTION_UP or ACTION_POINTER_UP).

check this

Community
  • 1
  • 1
Ram kiran Pachigolla
  • 20,897
  • 15
  • 57
  • 78
  • Yes...I agree But how to distinguish between a drag and touch event?? I mean a touch also has ACTION_DOWN...I tried taking the pressed position and cross checking that on the ACTION_UP which doesn't work unfortunately... – Sreekanth Karumanaghat Jul 10 '12 at 09:23