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
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 Fragment
s to achieve the same behavior