title: Using new IMMERSIVE mode in android kitkat
body: <p>I want to make an activity to go into IMMERSIVE mode and hide top and buttom system bars as soon as it starts.</p>
  
  <p>In developers site of android they say I should use <code>setSystemUiVisibility()</code> and provide <code>SYSTEM_UI_FLAG_IMMERSIVE</code>  and <code>SYSTEM_UI_FLAG_HIDE_NAVIGATION</code>.</p>
  
  <p>How can I do this in the <code>OnCreate()</code> method of the activity? I think the <code>setSystemUiVisibility</code> is not provided in the Activity class and it should happen in a view. Is there a workaround?</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>ok According to doorstuck I added the following lines but I dont see any changes, navigation bar and buttom buttons are still visible :</p>
  
  <pre><code>public class MainActivity extends Activity {
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
          if (savedInstanceState == null) {
          }
          getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
          getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_IMMERSIVE);
      }
  
      //Rest of activity code
  </code></pre>