title: App crashes on hiding ActionBar?
body: <p>I have a <code>Button</code> which <code>calls</code> function <code>hide_bar()</code> when clicked. </p>
  
  <pre><code>public void hide_bar(View v){
          ActionBar ab = getActionBar();
          ab.hide();
      }
  </code></pre>
  
  <p>But instead of hiding the Action Bar it <strong>crashes the app</strong>.</p>
  
  <p>How to fix this bug ?</p>
  
  <pre><code>FATAL EXCEPTION: main Process: com.example.prateek.myapp, PID: 19919 java.lang.IllegalStateException: Could not execute method of the activity Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.app.ActionBar.hide()' on a null object reference 
  </code></pre>
  
  <p><strong>UPDATE (Problem Fixed):</strong></p>
  
  <p>I was not able  to use <code>getActionBar()</code> because my <code>manifest</code> file defined the <strong>AppCompat theme</strong> for which you have to use <strong>getSupportActionBar()</strong> .</p>
  
  <p>After replacing Theme in manifest file to <code>Theme.Holo.Light</code> I was able to use <code>getActionBar()</code> method .</p>