Skip to content Skip to sidebar Skip to footer

How To Handle Swipe Down Gesture On An Imageview

I am trying for recognizing swipe down gesture on an imageview. I tried GestureDetector but it's deprecated now. Sample code I am using is below. But, it's not going inside onFling

Solution 1:

Try this ,Implements ongestureListener and theres a onscroll method u can access directly

@SuppressLint("NewApi")

publicclassAndroidExplorerextendsActivityimplements    
     android.view.GestureDetector.OnGestureListener

    {
    privateHandler mHandler = newHandler();
    @OverrideprotectedvoidonCreate(Bundle mybundle) 
    {
    // TODO Auto-generated method stub  super.onCreate(mybundle);
    setContentView(R.layout.main);
    }
    @OverridepublicbooleanonDown(MotionEvent e) {
        // TODO Auto-generated method stubreturnfalse;
    }
    @OverridepublicbooleanonFling(MotionEvent e1, MotionEvent e2, float velocityX,
            float velocityY) {
        // TODO Auto-generated method stubreturnfalse;
    }
    @OverridepublicvoidonLongPress(MotionEvent e) {
        // TODO Auto-generated method stub

    }
    @OverridepublicbooleanonScroll(MotionEvent e1, MotionEvent e2, float distanceX,
            float distanceY) {
        // TODO Auto-generated method stubreturnfalse;
    }
    @OverridepublicvoidonShowPress(MotionEvent e) {
        // TODO Auto-generated method stub

    }
    @OverridepublicbooleanonSingleTapUp(MotionEvent e) {
        // TODO Auto-generated method stubreturnfalse;
    }




}

Post a Comment for "How To Handle Swipe Down Gesture On An Imageview"