TabSwipeActivity to work with ActionBar without ActionBarSherlock

17 Views Asked by At

I had actionbarsherlock in my app implemented. Now I want to get rid of it as Im increasing to API 21 and think its not required anymore.

I have an ActionBar on in a TabSwipeActivity and this is the code I was using with actionSherlock.

public class InfoMain extends TabSwipeActivity  {
 
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        ActionBar mSupportActionBar = getSupportActionBar();
        mSupportActionBar.setDisplayHomeAsUpEnabled(true);      

        setTitle(" " +  "App Name");

        addTab(getString(R.string.tab_statistic), StatisticTab.class, StatisticTab.createBundle( "Fragment 1") );
        addTab(getString(R.string.tab_health), HealthTab.class, HealthTab.createBundle( "Fragment 2") );
        addTab(getString(R.string.tab_achievement), AchievementTab.class, AchievementTab.createBundle( "Fragment 3") );
        addTab("Info 1", Info1Tab.class, Info1Tab.createBundle( "Fragment 4") );
        addTab("Info 2", Info2Tab.class, Info2Tab.createBundle( "Fragment 5") );
    }

Error "Cannot resolve method 'getSupportActionBar' in 'InfoMain'"

What do I have to import or extend to make it work again?

0

There are 0 best solutions below