Call parent's activity from a fragment

user1746708 picture user1746708 · Jan 16, 2013 · Viewed 37k times · Source

If I'm inside a Fragment how can I call a parent's activity?

Answer

DcodeChef picture DcodeChef · Jan 16, 2013

Yes, Its right by calling getActivity and cast it with parent activity to access its methods or variables ((ParentActivityName)getActivity())

Try this one.

ParentActivityName is parent class name