Hi
Just upgrade my phone from 7.1 to 8.1 and seem to have lost immersive mode … bottom menu bar is permanently visible, I recall that immersive was set to be default behaviour for Android mode a year or so ago
… or maybe even longer than that… but does this need updating for the latest android versions?
Or… can some one provide a code snippet that would let me set immersive mode myself?
Many thanks
Mark
EDIT:
Just managed to get it working in Android Studio by pasting the code below into the Main Activity, but how can I get it to work in Processing? The errors I get are
1. ERROR in C:\Users\MArk\AppData\Local\Temp\android4180019193616482448sketch\app\src\main\java\com\softwarecreative\sessionsheddemo\SessionShed.java (at line 751)
public void onWindowFocusChanged(boolean hasFocus) {
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The method onWindowFocusChanged(boolean) of type SessionShed must override or implement a supertype method
----------
2. ERROR in C:\Users\MArk\AppData\Local\Temp\android4180019193616482448sketch\app\src\main\java\com\softwarecreative\sessionsheddemo\SessionShed.java (at line 752)
super.onWindowFocusChanged(hasFocus);
^^^^^^^^^^^^^^^^^^^^
The method onWindowFocusChanged(boolean) is undefined for the type PApplet
----------
2 problems (2 errors)
@Override
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
if (hasFocus) {
hideSystemUI();
}
}
private void hideSystemUI() {
// Enables regular immersive mode.
// For "lean back" mode, remove SYSTEM_UI_FLAG_IMMERSIVE.
// Or for "sticky immersive," replace it with SYSTEM_UI_FLAG_IMMERSIVE_STICKY
View decorView = getWindow().getDecorView();
decorView.setSystemUiVisibility(
View.SYSTEM_UI_FLAG_IMMERSIVE
// Set the content to appear under the system bars so that the
// content doesn't resize when the system bars hide and show.
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
// Hide the nav bar and status bar
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN);
}
// Shows the system bars by removing all the flags
// except for the ones that make the content appear under the system bars.
private void showSystemUI() {
View decorView = getWindow().getDecorView();
decorView.setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
}