Code example for ViewPager

0
    public HackyViewPager(Context context) {
        super(context);
    } 
 
    public HackyViewPager(Context context, AttributeSet attrs) {
        super(context, attrs);
    } 
 
    @Override 
    public boolean onInterceptTouchEvent(MotionEvent ev) {
        try { 
            return super.onInterceptTouchEvent(ev);
        } catch (IllegalArgumentException e) {
            e.printStackTrace();
            return false; 
        } 
    } 
 
}