Code example for FragmentActivity

Methods: getWindow, requestWindowFeature

0
    } 
 
    public void setFullScreen() { 
	actionBarAllowed = false;
	// activity in full screen 
	requestWindowFeature(Window.FEATURE_NO_TITLE);
	// requestWindowFeature(Window.FEATURE_ACTION_BAR); 
	getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
    } 
 
    public void setImmersive() { 
	actionBarAllowed = true;
	// activity in full screen 
	requestWindowFeature(Window.FEATURE_NO_TITLE);
	// requestWindowFeature(Window.FEATURE_ACTION_BAR); 
	getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
 
	getWindow().getDecorView().setSystemUiVisibility( 
		View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
    }