access parent fragment by child fragment

You can get parent Fragment's reference by :

ParentFragment parentFrag = ((ParentFragment)ChildFragment.this.getParentFragment());
parentFrag.someMethod();

I used this in my ViewPager. If you have other requirement, Interface or EventBus are two of the general ones.


Late answer but there is a quite simple way to access a fragment's parent fragment :

Kotlin

(parentFragment as YourParentFragment).parentFragmentMethod()

Java

((YourParentFragment) getParentFragment()).parentFragmentMethod();