trying to understand the logic of touch handling in android

You see new GestureDetectorCompat(); is a public constructor and it takes in 2 parameters Context GestureDetector.OnGestureListener
Even in this case, the this keyword is used in the same context and meaning.

One thing you are missing is, that the this keyword represents the current “Object” and not the current “Class”. So, if and when you create an object of this “Interface” (by implementing it in another class of course), the this keyword will represent that specific object.


The GestureDetector.OnGestureListener callback will notify users when a particular motion event has occurred. This class should only be used with MotionEvents reported via touch

this.gDetector.onTouchEvent(event); this will indicate that the event you want to handle is successful or not by showing true or false.

super.onTouchEvent(event); this is a call to use all other gestures events
Documentation You can refer this also.

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top