I have read through the related posts. In every quaestion I see that onActivityResult() of activity gets called at least..the problem is how to carry the result to the fragments or nested fragments. But issue I am facing is different.
I am implementing Settings page that will have tabs with TabLayout from new Design Support library. In my app I have a single Activity which holds other Fragments...so I added a SettingsTabFragment which has ViewPager and a FragmentPagerAdapter to it.This adapter holds fragments for each tab.
One of the tab is User Profile settings where user can add his profile pic. And I called startActivityResult() from child fragment with ACTION_PICK intent. I overriden the onActivityResult() in Activity, in parent fragment (that holds view pager) and in SettingsTabFragment too. But none of them get called when I chose the pic from gallery.
None of onActivityResult() get called when startActivityResult() called from:
- child fragment.
- parent fragment. I did this from child frag getParentFragment().startActivityResult() AND also from within the parent fragment itself which is attached to activity directly (not nested).
- called using activity from child fragment with getParentFragment().getActivity().startActivityResult().
None of them lead to call onActivityResult() of, at least, activity.
When I called startActivityResult() from fragment I made sure I called just startActivityResult()..not getActivity().startActivityResult().
I follwed onActivityResult is not being called in Fragment and tried the github lib suggested in one of the answers but seems owner told it is not recommended now. Also it has got compilation errors.
Nay thoughts on it ?