Code example for ViewPager

Methods: getAdaptergetCurrentItem

0
    /** 
     * Returns the currently showing fragment 
     * @return 
     */ 
    public TaskListFragment getCurrentFragment() { 
        return (TaskListFragment) ((TaskListFragmentPagerAdapter) getAdapter()).lookupFragmentForPosition(getCurrentItem()); 
    } 
 
    @Override 
    public boolean onInterceptTouchEvent(MotionEvent ev) {
        if (checkForPeopleHeaderScroll(ev))
            return false; 
 
        if (Flags.check(Flags.TLFP_NO_INTERCEPT_TOUCH)) 
            return false; 
 
        return super.onInterceptTouchEvent(ev);
    } 
 
    private boolean checkForPeopleHeaderScroll(MotionEvent ev) {
        TaskListFragment current = getCurrentFragment();