Java tutorial
//package com.java2s; import android.annotation.TargetApi; import android.app.Activity; import android.os.Build.VERSION_CODES; import android.view.View; public class Main { @TargetApi(VERSION_CODES.KITKAT) public static void hideSystemUI(Activity activity) { // Set the IMMERSIVE flag. // Set the content to appear under the system bars so that the content // doesn't resize when the system bars hideSelf and show. View decorView = activity.getWindow().getDecorView(); decorView.setSystemUiVisibility( 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 // hideSelf nav bar | View.SYSTEM_UI_FLAG_FULLSCREEN // hideSelf status bar | View.SYSTEM_UI_FLAG_IMMERSIVE); } }