1

Is it possible to use setSupportActionBar() in an TabActivity? Extending with AppCompatActivity is not possible...

public class TabHost extends TabActivity {

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.tabhost);


        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar); // this is unkown
        getSupportActionBar().setDisplayHomeAsUpEnabled(true); //also

Do I have to switch from TabActivity to FragmentTabHost? Thanks

Oli
  • 3,496
  • 23
  • 32

1 Answers1

1

no you can't. You have to extend AppCompatActivity, and you shouldn't use TabActivity in the first place. It was deprecated long time ago. You should use a solution based on a ViewPager and Fragments to achieve the same behavior

Blackbelt
  • 156,034
  • 29
  • 297
  • 305