The method getSupportLoaderManager() is undefined for the type Activity

1.8k views Asked by At

I'm getting "The method getSupportLoaderManager() is undefined for the type Activity" when using getSupportLoaderManager() inside a List Fragment. Do you have any ideas on how to fix this?

Thanks!

The ListActivity is defined as :

public class SelfieListActivity extends FragmentActivity implements SelfieListFragment.Callbacks{...}

And the ListFragment is defined as :

public class SelfieListFragment extends ListFragment implements LoaderCallbacks<Cursor>{...}

The line is inside the ListFragment and it's defined as :

    getActivity().getSupportLoaderManager().initLoader(_ID, null, this);

Thanks in advance!. Please let me know if you need more details.

1

There are 1 answers

2
CommonsWare On

You may be inheriting from android.app.ListFragment instead of android.support.v4.app.ListFragment.