title: Android Hide Navigation Bar/Stay in Immersive Mode with Soft Keyboard Appearance
body: <p>Working on a client's app that is using immersive mode to hide the navigation bar and status bar on every activity using the following code:</p>
  
  <pre><code>int currentApiVersion = android.os.Build.VERSION.SDK_INT;
  
  final int flags = 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
              | View.SYSTEM_UI_FLAG_FULLSCREEN
              | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
  
  // This work only for android 4.4+
  if (currentApiVersion &gt;= 19) {
  
          getWindow().getDecorView().setSystemUiVisibility(flags);
          // Code below is for case when you press Volume up or Volume down.
          // Without this after pressing valume buttons navigation bar will
          // show up and don't hide
          final View decorView = getWindow().getDecorView();
          decorView
                  .setOnSystemUiVisibilityChangeListener(new View.OnSystemUiVisibilityChangeListener() {
  
                      @Override
                      public void onSystemUiVisibilityChange(int visibility) {
                          if ((visibility &amp; View.SYSTEM_UI_FLAG_FULLSCREEN) == 0) {
                              decorView.setSystemUiVisibility(flags);
                          }
                  }
           });
  }
  </code></pre>
  
  <p>The only problem is that they would like the app to stay in immersive mode and not show the navigation bar even when the soft keyboard is showing to type into an EditText. Can anyone think of a way to always have the navigation buttons (back/hide keyboard, home, etc) always be hidden even while using the keyboard?</p>