android - Gesture Detector not working -


I have the following GestureListener:

  The Public Class BookListener extends SimpleOnGestureListener OnTouchListener {Private LibraryActivity Main; Private book book; Private gesture detector gestures; Public Book-Listener (Book Book, Library Activism Men) {this.main = main; This.book = book; Gesture = new gesture detector (main, this); } Public Boolean OnDelTap (Motion Avenger E) {Main Shoenfo (book); Back true; } SingleTapConfirmed on Public Boolean (MotionEvent E) {main.openBook (book.getUrl ()); Back true; } Public boolean ondown (motion avt) {return false; } @ Override Public Boolean On Touch (see We, Motion Avent Event) {Return Hint. Touch event (event); }}   

I add to my view like this:

  view.setOnTouchListener (New BookListener (book, main));   

But when running, are not the cause of the event, I debug it, I see called onDown, but onSingleTapConfirmed or onDoubleTap Nevers works.

What's wrong?

I have this code fully working with:

  Personal class GestureListener extends SimpleOnGestureListener {Private Boolean newEvent = true @ Override Public Boolean On Double Tap (Motion Event) E) {document.rescale (); RefreshImage (); Back true; } Public Boolean On Down (MotionEvent evt) {newEvent = true; return false; } @Override Public Boolean Onscroll (MotionEvent E1, MotionEvent e2, boat distanceX, distanceY float) {if (document.isScaled () & amp;! & Amp;; newEvent) {Vector2D V = New Vector2D (E2) .minus (New Vector2D (E1)); If (v.getX ()> 60+ V.A.T.XX () & lt; 60) {if (v.getX () <0) Next (); Other previous (); NewEvent = false; }} And {img.notifyScroll (-distanceX, -distanceY); Img.invalidate (); } Back true; } @ Override Public Boolean On Syningtap Confirmed (Motion Event E) {SwitchSidebar (); Back true; }}    

postprop = It is true even if you do not want to react to that event, or this detector will cancel any event and hence a gesture.

Comments