Code example for ActionBarActivity

Methods: getSupportActionBar

0
 
        setContentView(R.layout.action_bar_tabs); 
    } 
 
    public void onAddTab(View v) {
        final ActionBar bar = getSupportActionBar();
        final int tabCount = bar.getTabCount();
        final String text = "Tab " + tabCount;
        bar.addTab(bar.newTab()
                .setText(text)
                .setTabListener(new TabListener(new TabContentFragment(text))));
    } 
 
    public void onRemoveTab(View v) {
        final ActionBar bar = getSupportActionBar();
        if (bar.getTabCount() > 0) {
            bar.removeTabAt(bar.getTabCount() - 1);
        } 
    } 
 
    public void onToggleTabs(View v) {