Code example for ViewPager

0
    public MyViewPager(Context context) {
        super(context);
    } 
 
    public MyViewPager(Context context, AttributeSet attrs) {
        super(context, attrs);
    } 
 
    public void setGestureDetector(GestureDetector gestureDetector) {
        this.gestureDetector = gestureDetector;
    } 
 
    @Override 
    public boolean onTouchEvent(MotionEvent ev) {
        if (this.gestureDetector != null)
            this.gestureDetector.onTouchEvent(ev);
        return super.onTouchEvent(ev);
    } 
 
    @Override 
Connect your IDE to all the code out there  Get Codota for Java