Code example for ViewPager

Methods: setAdapter

0
 
    @Override 
    public void setAdapter(PagerAdapter adapter) {
        if (!(adapter instanceof TaskListFragmentPagerAdapter))
            throw new ClassCastException("TaskListFragmentPager requires an adapter of type TaskListFragmentPagerAdapter"); //$NON-NLS-1$
        super.setAdapter(adapter);
    } 
 
    /** 
     * Hack to enable reloading fragments while they are being viewed 
     */ 
    public void forceReload() { 
        int position = getCurrentItem();
        setAdapter(getAdapter()); 
        setCurrentItem(position, false);
    } 
 
    /** 
     * Show the supplied filter, adding it to the data source if it doesn't exist 
     * @param f 
     */