Code example for ActionBar

Methods: setSelectedNavigationItem

0
        public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
        } 
 
        @Override 
        public void onPageSelected(int position) {
            mActionBar.setSelectedNavigationItem(position);
        } 
 
        @Override 
        public void onPageScrollStateChanged(int state) {
        } 
 
        @Override 
        public void onTabSelected(Tab tab, FragmentTransaction ft) {
            Object tag = tab.getTag();
            for (int i=0; i<mTabs.size(); i++) {
                if (mTabs.get(i) == tag) {
                    mViewPager.setCurrentItem(i);
                } 
            } 
        }