I'm quite new in Android development. In my application, I use a class that is a part of all my activities. It allows me to define that all my application will be in full screen mode.
Here is the code of this class :
package com.retroverse.bataille_corse;
import android.os.Build;
import android.os.Bundle;
import android.view.View;
import androidx.appcompat.app.AppCompatActivity;
public class FullScreenActivity extends AppCompatActivity {
@Override
protected void onResume() {
super.onResume();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
this.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
| View.SYSTEM_UI_FLAG_FULLSCREEN);
}
}
}
The full screen mode works perfectly, except in a very specific case. When I'm in my application, I press the "home" button of the navigation bar, then when I want to resume the application (only like this) by clicking on the "app menu" button of the navigation bar (when you see the applications that are still open) and resume the application, the notification bar reappears when it shouldn't (and only it, there's never any problem with the navigation bar)... But it disappears when I change activity.
Here is a video to better understand : https://drive.google.com/open?id=1FPoADemhLcPfxnohQdfYOpb6wkxQTx5q
I also tried adding
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LOW_PROFILE
But it didn't change anything (besides I don't really know what these 2 views are for)...
I really need help, thanks!!
You can remove the status bar by going to each activity and set this in your OnCreate method:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.your_layout);
}