3

I'm new to android and trying to learn intercept touch events handling using this documentation, but i do not understand that calculateDistanceX(MotionEvent) 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.

MamadTell
  • 163
  • 1
  • 12

1 Answers1

5

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()

Charles Durham
  • 2,445
  • 16
  • 17