OnClickListener - x,y location of event?

Posted by Mark on Stack Overflow See other posts from Stack Overflow or by Mark
Published on 2009-12-27T21:03:33Z Indexed on 2010/04/21 11:03 UTC
Read the original article Hit count: 159

Filed under:
|

Hi,

I have a custom view derived from View. I'd like to be notified when the view is clicked, and the x,y location of where the click happened. Same for long-clicks.

Looks like to do this, I need to override onTouchEvent(). Is there no way to get the x,y location of the event from an OnClickListener instead though?

If not, what's a good way of telling if a motion event is a 'real' click vs a long-click etc? The onTouchEvent generates many events in rapid succession etc.

Thanks

© Stack Overflow or respective owner

Related posts about android

Related posts about android-sdk