Code example for ViewPager

Methods: getAdaptergetCurrentItemonInterceptTouchEvent, getWidth

0
    } 
 
    @Override 
    public boolean onInterceptTouchEvent(MotionEvent event) {
 
        if (((FragmentPagerAdapter) getAdapter()).getItem(getCurrentItem()) instanceof SupportMapFragment) {
            if (event.getAction() == MotionEvent.ACTION_DOWN
                    && event.getX() < (getWidth() - (getWidth() / NON_DRAGABLE_FRACTION))
                    && event.getX() > (getWidth() / NON_DRAGABLE_FRACTION)) {
 
                return false; 
            } 
        } 
        return super.onInterceptTouchEvent(event);
    } 
}