Im trying to Combine drawer navigation and tab navigation together. I have successfully combined the 2. When i launched the app for first time, everything works fine. However, after I click on the drawer item and back to the tabs fragments, there are too many tabs added. I tried to limit the number and it did not work. Also, when I open the other fragments in the drawer item, the tabs still remains.
here's some pictures to show
when I first open the app

after I open the drawer

When I back to the first fragment again

Here's my code for the tabs fragment's on createview
 private ActionBar actionBar;
private String[] tabs={ "1", "2", "3","4" };
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.activity_home, container, false);
    mSectionsPagerAdapter = new SectionsPagerAdapter(
            getChildFragmentManager());
    mViewPager = (ViewPager) v.findViewById(R.id.pager);
    mViewPager.setAdapter(mSectionsPagerAdapter);
    mViewPager.setOnPageChangeListener(
            new ViewPager.SimpleOnPageChangeListener() {
                @Override
                public void onPageSelected(int position) {
                    // When swiping between pages, select the
                    // corresponding tab.
                    getActivity().getActionBar().setSelectedNavigationItem(position);
                }
            });
    actionBar=getActivity().getActionBar();
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
    ActionBar.TabListener tabListener = new ActionBar.TabListener() {
        public void onTabSelected(ActionBar.Tab tab, FragmentTransaction ft) {
            // show the given tab
            mViewPager.setCurrentItem(tab.getPosition());
        }
        public void onTabUnselected(ActionBar.Tab tab, FragmentTransaction ft) {
            // hide the given tab
        }
        public void onTabReselected(ActionBar.Tab tab, FragmentTransaction ft) {
            // probably ignore this event
        }
    };
    for (String tab_name : tabs) {
         actionBar.addTab(actionBar.newTab().setText(tab_name)
                        .setTabListener(tabListener));
    }
    return v;
}
I think its the
actionBar.addTab(actionBar.newTab().setText(tab_name)
                        .setTabListener(tabListener));
part that makes this happened , can anyone help me how to fix it?
 
     
     
    