If my fullscreen preference (off by default) is on, I want my Activity to hide the title bar as well as the notification bar. I can do that with requestWindowFeature(Window.FEATURE_NO_TITLE);
+ FLAG_FULLSCREEN
etc. or perhaps setTheme(android.R.style.Theme_NoTitleBar_Fullscreen);
Either of these must happen before setContentView()
or they will crash. The hard part is:
FEATURE_NO_TITLE
will hide the ActionBar and lose some important controls. (I'll instead settle for "lights-out" mode.)setContentView()
, when it's too late.Things that don't work:
getActionBar()
returns null at this early stage.getWindow.hasFeature(Window.FEATURE_ACTION_BAR)
is false.Any ideas? :-)
I think what you want to use instead is ActionBarSherlock. It takes care of all the reflection and API level detection for you.