Jonas
Jonas

Reputation: 3020

Recognize click from MotionEvent stream

Is there a way to detect a click from MotionEvents in Android? To be more specific, I need a way to distinct two kind of events: movement and click (I'm more interested in the latter).

For example, this kind of behavior can be observed in MapView component: if you drag the map just a little - it does not move (I would call this a click), however if movement distance is bigger the map starts to move as well (I would call this movement). Is there a standard threshold (global parameter) or other method to distinct these two actions?

Upvotes: 0

Views: 2306

Answers (1)

Noel
Noel

Reputation: 7410

You can implement an OnGestureListener. onSingleTapUp() will be called for a click type event and onScroll() will be called for a movement type event.

Upvotes: 2

Related Questions