Search code examples
android-fragmentactivityandroid-cursorloader

FragmentActivity, CursorLoader and getActivity undefined


I'm using a CursorLoader in a FragmentActivity following the sample code here.

When I try to compile, however, Eclispe gives me the error:

The method getActivity is undefined for the class

How I can solve this?


Solution

  • FragmentActivity does not have any getActivity() method like Fragment have. If you want to get the activity you should use this keyword inside FragmentActivity.