Skip to content Skip to sidebar Skip to footer

Actionbar Nullpointerexception

I want to use ActionBarSherlock with my app. When I call getSupportActionBar() I get a NullPointerException; I already imported the ActionBarSherlock library into my project. Here

Solution 1:

Does your application theme extend the ABS theme?

For instance, as you specify:

android:theme="@style/AppTheme"

Your style should be:

<stylename="AppTheme"parent="Theme.Sherlock.Light">
    ...
</style>

See also this answer by Jake Wharton himself.

Solution 2:

I cannot now explain why you are getting the NPE but please try this:

Instead of using

getSupportActionBar().setTitle("Example!");  //nullpointerException

just use this

setTitle("Example!");

Post a Comment for "Actionbar Nullpointerexception"