Code example for GestureDetector

Methods: setIsLongpressEnabled

     * Constructor 
     * @param context the current context 
     * @param listener the scrolling listener 
    public WheelScroller(Context context, ScrollingListener listener) {
        gestureDetector = new GestureDetector(context, new SimpleOnGestureListener() {
            public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {
                // Do scrolling in onTouchEvent() since onScroll() are not call immediately 
                //  when user touch and move the spinnerwheel 
                return true; 
            public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
                lastScrollPosition = 0;
                scrollerFling(lastScrollPosition, (int) velocityX, (int) velocityY);
                return true; 
            // public boolean onDown(MotionEvent motionEvent); 
        scroller = new Scroller(context);
        this.listener = listener;
        this.context = context;
Stop searching for code, let great code find you!  Add Codota to your java IDE