In my fragment I call a method from my parentActivity which has a ViewPager with a FragmentStatePagerAdapter.
I read on some posts that casting an Activity can cause errors, but because I only have one parentActivity which manages all my fragments, I don't see why it would cause an error.
Method call in fragment
((MainActivity) getActivity()).getSDCardAccess();
Method in parentActivity
public void getSDCardAccess(){
Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT_TREE);
startActivityForResult(intent, REQUEST_EXTERNAL_ACCESS);
}