private void hideSystemUI() {
View decorView = getWindow().getDecorView();
int uiOptions = View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION // hide nav bar
| View.SYSTEM_UI_FLAG_FULLSCREEN // hide status bar
| View.SYSTEM_UI_FLAG_IMMERSIVE;
decorView.setSystemUiVisibility(uiOptions);
}
and also:
@Override
public void onWindowFocusChanged(boolean hasFocus)
{
super.onWindowFocusChanged(hasFocus);
View decorView = getWindow().getDecorView();
decorView.setOnSystemUiVisibilityChangeListener(
newView.OnSystemUiVisibilityChangeListener() {
@Override
public void onSystemUiVisibilityChange(int i) {
if (i == View.VISIBLE){
hideSystemUI();
}
else {
hideSystemUI();
}
}
});
wrote the hidesystemUI() code in onCreate() and onResume() also, including with decorView.setOnSystemUiVisibilityChangeListener(). So i have to block it. Once i swipe at the top, it is coming and going back ( like a blink). But i have to block it. Once we swipe at the top it should not appear. help me out of this.