MamadTell MamadTell - 1 year ago 189
Android Question

calculateDistanceX(MotionEvent) method in intercept touch events handling

I'm new to android and trying to learn intercept touch events handling using this documentation, but i do not understand that

method at all, and the more I searched about it the less i found. I'm completely confused.

Could anyone please explain it to me?

Thanks in advance.

Answer Source

It says that the method calculateDistanceX() is left as an exercise for a user. One solution would be to cache the first MotionEvent and then the distance would be mFirstMotionEvent.getX() - currentMotionEvent.getX()

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download