-2

I have tried to hide my ActionBar. With the method getSupportActionBar().hide(); everything works perfectly. My minSdkVersion is like I said in this question Android Studio - Action Bar remove higher than 11 (mine is 14).

Why is getActionBar().hide(); not working?

Community
  • 1
  • 1
Pepe Bellin
  • 85
  • 1
  • 12
  • Why do you use `getActionBar()`? – Nikola Despotoski Aug 30 '16 at 20:19
  • What shall I use instead? – Pepe Bellin Aug 30 '16 at 20:23
  • 1
    If `getSupportActionBar().hide()` is working, why not use it? The oldest you should consider supporting is 4.4 KitKat (API 19). KitKat and above covers about 95% of Android users. – privatestaticint Aug 30 '16 at 20:28
  • Keep using support action bar for all api levels. – Nikola Despotoski Aug 30 '16 at 20:28
  • @private Where did you get that number, according to Google it is more like 80%
    It also makes a difference if you are releasing a new app, or updating an old one. When you are updating an old one, you don't want ton estrange your users. Also, you will keep on getting complaints about old bugs, as old users cannot update.
    – lionscribe Aug 31 '16 at 02:28
  • @lionscribe you're right, it is more like 80%, but even then, if you have it at API 16 then you get 97% of users. Supporting 14 or even 11 is kind of absurd. – privatestaticint Sep 01 '16 at 21:38

1 Answers1

0

I imagine you are using the Android Support Toolbar, setting it with setSupportActionBar, not the built in AppBar. Therefore only getSupportActionBar works, and not getActionBar, as there is no built in action bar in your app.

lionscribe
  • 3,413
  • 1
  • 16
  • 21