Search code examples
androidactionbarsherlockbundleundefined

The method onActivityCreated(bundle) is undefined for the type SherlockFragment


I'm trying to work on a project that implements actionBarSherlock, I've added the library to the project properly and I get this error:

The method onActivityCreated(bundle) is undefined for the type SherlockFragment

This is the code from the project:

public class A_class extends SherlockFragment implements
    OnClickListener { ... }

I think the answer is quite simple but I can't work it out. Any ideas?


Solution

  • There are two ways:

    If you want to use a fragment with sherlock features use SherlockFragment. In this case you cannot have activity related method since its a "Fragment"

    Otherwise you are looking for SherlockFragmentActivity