How to detect doubletap on a View?

Possible Duplicate:
Android – basic gesture detection

I’m trying to have a View sensitive to double taps on an Android. So far, I learned to set up the double tap and know what place to handle the event for action:
API: android.view.GestureDetector.OnDoubleTapListener

  • Android NumberPicker: Set min, max, default from XML
  • How to open number dialer pad programmatically in android?
  • Android: AutoCompleteTextView show suggestions when no text entered
  • Font in Android Library
  • Setting system time of ROOTED phone
  • ScrollView auto scrolls to selectable TextView
  •     private GestureDetector mGestureDetector;
        …
        mGestureDetector = new GestureDetector(this);
        …
        mGestureDetector.setOnDoubleTapListener(new MyDoubleTapListener());
        …
        private class MyDoubleTapListener implements GestureDetector.OnDoubleTapListener {
        public boolean onDoubleTapEvent(MotionEvent e) {                         
                                        return false;                      
        }
                        @Override
                        public boolean onDoubleTap(MotionEvent e) {
                                        // TODO Auto-generated method stub
                                        return false;
                        }
    
                        @Override
                        public boolean onSingleTapConfirmed(MotionEvent e) {
                                        // TODO Auto-generated method stub
                                        return false;
                        }
    }
    

    But How do I link it to the View? This is in a class that has a few View members.

    I’ll really appreciate you helping me connect the dots!

    Related posts:

    Service Automatic Called on Destroying Activity
    Android: ToggleButton Listener
    Wildcard not working in SQLite
    Android Syntax Highlighting?
    JNI: From C code to Java and JNI
    How to create android Ad Interstitial?
  • com.android.sdklib.build.ApkCreationException: Debug Certificate expired error
  • How are the values of android.graphics.Matrix used?
  • Ways to guess if C2DM is connected
  • What are the differences among Internal storage, external storage, sd card and removable storage?
  • Android ListView with different layouts for each row
  • Getting GMT time with Android
  • One Solution collect form web for “How to detect doubletap on a View?”

    Your view needs to implement the onTouchEvent() method, and that method needs to pass the event along to the onTouchEvent() method of the GestureDetector object.

    @Override
    public boolean onTouchEvent(MotionEvent event) 
    {
        Log.v(DEBUG_TAG,"OnTouchEvent !!!");
        boolean result = gestureScanner.onTouchEvent(event);//return the double tap events
        return result;
    }
    
    Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.