0

I want to build a full screen method into my Android app.

I have everything set up, my code actually is like:

case R.id.full:
            this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
            return true;

This resides inside my onOptionsItemSelected() and works without a hassle.

My problem is: How do I give the user the choice to revert it back to normal? Any ideas?

Also, when doing this my text string inside the options menu is still "Go Full Screen", it didn't change. Maybe a text change like "Normal Screen" with the according event would be better.

Thanks in advance!

Timmy
  • 4,098
  • 2
  • 14
  • 34
c1ph4
  • 141
  • 1
  • 9
  • hope that I am not stating the obvious but you can try FLAG_FORCE_NOT_FULLSCREEN – magmike May 28 '14 at 19:50
  • Nice one! But this doesn't revert back correctly: The bar of my own app seems like cutted. The top of my app bar slides under the status bar in this case. And I can't revert back to normal... – c1ph4 Jun 03 '14 at 20:08
  • Done: http://stackoverflow.com/questions/9684440/android-exit-from-full-screen-mode :-) – c1ph4 Jun 04 '14 at 20:34

1 Answers1

0

You can override onPrepareOptionsMenu (Menu menu) method to enable disable or change the text of the menu items. This method is called right before the menu is shown everytime.

http://developer.android.com/reference/android/app/Activity.html#onPrepareOptionsMenu%28android.view.Menu%29

Karthik
  • 934
  • 9
  • 21