title: setOnSystemUiVisibilityChangeListener only works in main activity for hidding navigation bar
body: <p>I want to hide the navigation bar in my Android application. I have written the following class:</p>
  
  <pre><code>import android.view.View;
  
  public class NavigationUtils {
      private NavigationUtils() {
      }
  
      public static void hideNavigation(View decorView) {
          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
                  | View.SYSTEM_UI_FLAG_FULLSCREEN
                  | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
      }
  }
  </code></pre>
  
  <p>When I call this method in the <code>onResume()</code> method, the navigation bar is hidden. In addition in the <code>onCreate()</code> method of my <strong>main activity</strong> I'm using the following piece of code:</p>
  
  <pre><code>    View decorView = getWindow().getDecorView();
      decorView.setOnSystemUiVisibilityChangeListener
              (new View.OnSystemUiVisibilityChangeListener() {
                   @Override
                   public void onSystemUiVisibilityChange(int visibility) {
                       if ((visibility &amp; View.SYSTEM_UI_FLAG_FULLSCREEN) == 0) {
                           NavigationUtils.hideNavigation(getWindow().getDecorView());
                       }
                   }
               }
              );
  </code></pre>
  
  <p>When I click on an EditText the soft keyboard opens as well as the navigation bar. With the above code the navigation bar is again hidden when the soft keyboard is closed. This works nicely in the <strong>main activity</strong>.</p>
  
  <p>Now I have started <strong>another activity</strong> from the main activity and I have added the same piece of code in the <code>onCreate()</code> method as above.</p>
  
  <p>But now when I exit the soft keyboard (after editing an EditText) in the new activity the navigation bar is no more hidden.</p>
  
  <p>What can I do?</p>
  
  <p>Edit: The entries in the manifest for the two activities are the following:</p>
  
  <pre><code>    &lt;activity
          android:name=".MainActivity"
          android:configChanges="orientation"
          android:screenOrientation="landscape"&gt;
          android:label="@string/app_name"&gt;
          &lt;intent-filter&gt;
              &lt;action android:name="android.intent.action.MAIN" /&gt;
  
              &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
          &lt;/intent-filter&gt;
      &lt;/activity&gt;
  
      &lt;activity
          android:name=".SensorReadingsActivity"
          android:screenOrientation="landscape" /&gt;
  </code></pre>