Search code examples
androidactionbarsherlockandroid-studio

Android Studio: Cannot resolve method 'getSupportActionBar()'


I just added ActionBarSherlock to my project using these instructions, and the project compiled. But I haven't been able to actually use the library. Trying to use getSupportActionBar() just yields a Cannot resolve method error.

I'm referencing the library at the top of the class. Actually, import com.actionbarsherlock.app.ActionBar and import com.actionbarsherlock.* came up in the suggestions dialog, but I've tried both separately, and both come with the warning Unused import statement. So it seems my project doesn't actually know there's a connection between getSupportActionBar() and the ActionBarSherlock library. Any ideas on why/how to fix it?


Solution

  • I bet that you extend an Activity and not a SherlockActivity

    Also do not forget to use a Sherlock Theme