title: getActionBar().setDisplayHomeAsUpEnabled(true) throws NullPointerException
body: <p>This question is asked several times in stackoverflow and I have tried all of them. But unfortunately neither is working for me. </p>
  
  <p>I am trying to implement the navigation between two activities, as part of learning Android app development. My minium SDK and target SDK versions are 11 and 21 (Android 5), respectively. My settings in AndroidManifest.xml are shown below:</p>
  
  <pre><code>&lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.example.navigation"
      android:versionCode="1"
      android:versionName="1.0" &gt;
  
      &lt;uses-sdk
          android:minSdkVersion="11"
          android:targetSdkVersion="21" /&gt;
  
      &lt;application
          android:allowBackup="true"
          android:icon="@drawable/ic_launcher"
          android:label="@string/app_name"
          android:theme="@style/AppTheme" &gt;
          &lt;activity
              android:name=".MainActivity"
               &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=".DetailActivity" &gt;       
          &lt;/activity&gt;
      &lt;/application&gt;
  &lt;/manifest&gt;
  </code></pre>
  
  <p>I have two activities: MainActivity and DetailActivity. When I click a button in MainActivity, the app successfully opens the DetailActivity. But when I am trying to enable the back button by using the following code, it returns a NullPointerExcepion:</p>
  
  <pre><code>getActionBar().setDisplayHomeAsUpEnabled(true);
  </code></pre>
  
  <p>My both the classes extend ActionBarActivity.</p>
  
  <p>In MainActivity.java:</p>
  
  <pre><code>public class MainActivity extends ActionBarActivity {
  ...
  }
  </code></pre>
  
  <p>In DetailActivity.java:</p>
  
  <pre><code>public class DetailActivity extends ActionBarActivity{
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_detail);
  
          getActionBar().setDisplayHomeAsUpEnabled(true); // returns null pointer
  }
  </code></pre>
  
  <p>I have also tried changing the themes. For example, <code>android:theme="@android:style/Theme.Holo.Light"</code>.</p>