Code example for ViewPager

Methods: setCurrentItem

0
    /** 
     * Show the filter at the supplied index, with animation 
     * @param index 
     */ 
    public void showFilter(int index) {
        setCurrentItem(index, true);
    } 
 
    /** 
     * 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;