Sreekanth Karumanaghat
Sreekanth Karumanaghat

Reputation: 3403

Handling drag and touch inside onTouch

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

Upvotes: 0

Views: 1311

Answers (2)

Ram kiran Pachigolla
Ram kiran Pachigolla

Reputation: 21191

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

Upvotes: 1

Nermeen
Nermeen

Reputation: 15973

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

Upvotes: 1

Related Questions