Saturday, September 5, 2015

How to hide the TSB(nav bar - back, home, recent) no matter what version of Android you are using

You can do it with this:
   public void HideNavbar() {
        if(Build.VERSION.SDK_INT < 19) //API 18 or below
            View v = this.getWindow().getDecorView();
            v.setSystemUiVisibility(View.GONE);
        } else { //API 19 or above
            View decorView = getWindow().getDecorView(); 
            int uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
                          | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
            decorView.setSystemUiVisibility(uiOptions);
        }
    }