Code example for ViewPager

Methods: getAdapter, getCurrentItem, setCurrentItem

0
        } 
        return false; 
    } 
 
    public boolean pageToLast(boolean smoothScroll) {
        if (mLock == LOCK_BOTH || mLock == LOCK_FORWARD || getAdapter() == null) return false;
 
        if (getCurrentItem() != getAdapter().getCount() - 1) { 
            setCurrentItem(getAdapter().getCount() - 1, smoothScroll);
            return true; 
        } 
        return false; 
    } 
 
    @Override 
    public Parcelable onSaveInstanceState() {
        final Bundle bundle = new Bundle();
        bundle.putParcelable("instanceState", super.onSaveInstanceState());
        bundle.putInt("mLock", mLock);
        return bundle;
    }