Android ListView onTouchEvent does not give ACTION_DOWN
In order to have a function to reorder a list, I turned to this implementation .
My problem is that when I try to drag and drop an item into my ListView, I don't get the ACTION_DOWN event. Instead, for a single stroke motion, I get 2 ACTION_MOVE events (action = 0x00000002) and one ACTION_UP event (action = 0x00000001) in that order.
I've looked at similar questions, but it looks like everyone has the opposite problem, only getting ACTION_DOWN events. Anyone have any idea why this is happening?
Thanks, Yoel
It turns out I need to add this little piece of code:
@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
return super.onInterceptTouchEvent(ev);
}
Now I am getting ACTION_DOWN events in the OnTouchEvent function and everything is working fine.
I used the same code.
My problem was also that something was consuming the event and I couldn't find what it was ... but I managed to solve it using onInterceptTouchEvent to return true on the events I need on the onTouchEvent .
Problem solved :-)