I have errors in my class MainActivity.
The error: The method getActivity() is undefined for the type MainActivity
publ
You want getActivity()
inside your class. It's better to use
yourclassname.this.getActivity()
Try this. It's helpful for you.
If you want to call your activity, just use this . You use the getActivity method when you are inside a fragment.
This is because you're using getActivity()
inside an inner class. Try using:
SherlockFragmentActivity.this.getActivity()
instead, though there's really no need for the getActivity()
part. In your case,
SherlockFragmentActivity .this
should suffice.
In my application, it was enough to use:
myclassname.this