Android: getSupportActionBar() always returns null in ActionBarSherlock library Android: getSupportActionBar() always returns null in ActionBarSherlock library android android

Android: getSupportActionBar() always returns null in ActionBarSherlock library


You should add the Sherlock theme to your application

<application android:icon="@drawable/icon" android:label="@string/app_name"        android:debuggable="false" android:theme="@style/Theme.Sherlock">


I had the same problem on the Android ICS 4.0.4. I was using requestWindowFeature(Window.FEATURE_NO_TITLE); on the FragmentActivity, but this was hiding the ActionBar on ICS+ devices that caused the getSupportActionBar() to be null.

Simply removed the:
requestWindowFeature(Window.FEATURE_NO_TITLE);

And it worked like a charm.

Hope it helps someone.


Another reason this will happen on Honeycomb+ devices is because the windowNoTitle attribute is set in your style. Get rid of that as ActionBarSherlock will automatically remove it in pre-Honeycomb devices for you.