I added this code to my app ;
View decorView = getWindow().getDecorView();
// Hide both the navigation bar and the status bar.
int uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN;
decorView.setSystemUiVisibility(uiOptions);
But The code forces me to add "SuppressLint NewApi to MainActivity".Also there is an error about "View.SYSTEM_UI_FLAG_FULLSCREEN".Code says "CHANGE TO...." so what I must do I don't know.
Please help me.Thanks a lot.
The code that you use is for API level 14 or higher, like described in the documentation here
The
SuppressLint NewApi to MainActivity
happens because probably your target API level (or your minTarget) is less than 14.And as this post says, you can't hide the navigation bar
EDIT:
Set your
android:minSdkVersion="14"
There's a restriction: you if are using a device that don't have the traditional hardware keys (back,Home,Menu) you can't hide the navigation bar.