Question

I am overriding both onTouch and onClick. Each is supposed to result in different actions (very important). I don't want a touch to be both a touch and a click: it must be either-or. I am not having much luck. How do I get my app to discriminate between onTouch and onClick? Right now, either I get onTouch by itself or I get both onTouch and onClick together (based on whether I change onTouch to return true or false).

Was it helpful?

Solution

An easy solution is to just use onTouch(). Look for ACTION_UP and ACTION_DOWN. Store the position of the touch in ACTION_DOWN, and in ACTION_UP if the distance between the touch and the stored touch are < X then fire a custom click event, otherwise fire the drag event.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top