Code example for ActionBar.Tab

Methods: setTabListener, setText

0
        tabB.setText("Tab B");
        tabB.setTabListener(new TabListener<FragmentB>(this, "Tag B", FragmentB.class));
        actionBar.addTab(tabB);
         
        Tab tabC = actionBar.newTab();
        tabC.setText("Tab C");
        tabC.setTabListener(new TabListener<FragmentC>(this, "Tag C", FragmentC.class));
        actionBar.addTab(tabC);
         
        if (savedInstanceState != null) {
            int savedIndex = savedInstanceState.getInt("SAVED_INDEX");
            getActionBar().setSelectedNavigationItem(savedIndex);
        } 
         
    } 
 
 @Override 
 protected void onSaveInstanceState(Bundle outState) {
  // TODO Auto-generated method stub 
  super.onSaveInstanceState(outState);
  outState.putInt("SAVED_INDEX", getActionBar().getSelectedNavigationIndex());