if you call startActivityForResult() in the fragment, the result is delivered to the parent activity.
public void onActivityResult(int requestCode, int resultCode, Intent intent) { super.onActivityResult(requestCode, resultCode, intent);
How does it work
if you see requestCode in action, it will be like 655545, now
super.onActivityResult () will calculate the desired fragment and request code.
if your fragment in the list of the desired ViewPager fragment is found using
requestCode>>16
and requestCode is requestCode&0xffff .
source share