title: BluetoothChat example: NullPointerException
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/10031180/getactionbar-returns-null">getActionBar returns null</a>  </p>
  </blockquote>
  
  
  
  <p>Complete Android noob. I am trying to run the BluetoothChat example from a Galaxy S3, and it appears to crash the moment the application is run.</p>
  
  <p>Here is the LogCat output:</p>
  
  <pre><code>09-14 15:47:23.400: E/AndroidRuntime(6098): FATAL EXCEPTION: main
  09-14 15:47:23.400: E/AndroidRuntime(6098): java.lang.NullPointerException
  09-14 15:47:23.400: E/AndroidRuntime(6098):     at com.example.android.BluetoothChat.BluetoothChat.setStatus(BluetoothChat.java:235)
  09-14 15:47:23.400: E/AndroidRuntime(6098):     at com.example.android.BluetoothChat.BluetoothChat.access$4(BluetoothChat.java:233)
  09-14 15:47:23.400: E/AndroidRuntime(6098):     at com.example.android.BluetoothChat.BluetoothChat$2.handleMessage(BluetoothChat.java:260)
  09-14 15:47:23.400: E/AndroidRuntime(6098):     at android.os.Handler.dispatchMessage(Handler.java:99)
  09-14 15:47:23.400: E/AndroidRuntime(6098):     at android.os.Looper.loop(Looper.java:137)
  09-14 15:47:23.400: E/AndroidRuntime(6098):     at android.app.ActivityThread.main(ActivityThread.java:4514)
  09-14 15:47:23.400: E/AndroidRuntime(6098):     at java.lang.reflect.Method.invokeNative(Native Method)
  09-14 15:47:23.400: E/AndroidRuntime(6098):     at java.lang.reflect.Method.invoke(Method.java:511)
  09-14 15:47:23.400: E/AndroidRuntime(6098):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:993)
  09-14 15:47:23.400: E/AndroidRuntime(6098):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:760)
  09-14 15:47:23.400: E/AndroidRuntime(6098):     at dalvik.system.NativeStart.main(Native Method)
  </code></pre>
  
  <p>Code is exactly per the example in the SDK:</p>
  
  <pre><code>private final void setStatus(int resId) {
      final ActionBar actionBar = getActionBar();
      actionBar.setSubtitle(resId);
  }
  </code></pre>
  
  <p>It appears getActionBar returns null. What might I be doing incorrectly?</p>
  
  <p>This is only the 2nd Android app I have run, so go easy on me :)</p>
  
  <p>Cheers</p>