title: Hide Navigation Bar when soft keyboard is launched Android
body: <p>I am trying to hide the Navigation bar when the keyboard is launched from an edit text in a activity. i have tried a lot of solutions, but haven't had much luck.</p>
  
  <p>The following code i found here in this forum, but it doesn't eliminate the nav bar when the keyboard is launched.</p>
  
  <pre><code>private void setupMainWindowDisplayMode()
  {
      View decorView = setSystemUiVisilityMode();
      decorView.setOnSystemUiVisibilityChangeListener(
              new View.OnSystemUiVisibilityChangeListener()
              {
                  @Override
                  public void onSystemUiVisibilityChange(int visibility)
                  {
                      setSystemUiVisilityMode(); // Needed to avoid exiting immersive_sticky when keyboard is displayed
                  }
              });
  }
  
  private View setSystemUiVisilityMode()
  {
      View decorView = getWindow().getDecorView();
      int options;
      options = 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_STICKY | View.SYSTEM_UI_FLAG_IMMERSIVE |
              View.SYSTEM_UI_LAYOUT_FLAGS;
  
      decorView.setSystemUiVisibility(options);
      return decorView;
  }
  </code></pre>
  
  <p>Any suggestions would be gratefully appreciated</p>