Possible Duplicate:
getActionBar returns null
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.
Here is the LogCat output:
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 is exactly per the example in the SDK:
private final void setStatus(int resId) {
final ActionBar actionBar = getActionBar();
actionBar.setSubtitle(resId);
}
It appears getActionBar returns null. What might I be doing incorrectly?
This is only the 2nd Android app I have run, so go easy on me :)
Cheers