I'm writing this StackOverflow question because I haven't read a clear question resolution about the Android onActivityResult
functioning when fragments AND activities are involved. What I would like to have (even though I'm pretty sure I won't have much participation) would be to have elements here to understand how onActivityResult
in each case, as some of them seem quite random.
From what I've seen on the questions on SO, there is the classic case (startActivityForResult
and onActivityResult
on the same activity) and 3 confusing/not working cases:
Calling
startActivityForResult
from a fragment and usingonActivityResult
on the parent activityCalling
startActivityForResult
from an activity and usingonActivityResult
on a fragment belonging to the activityCalling
startActivityForResult
from a fragment and usingonActivityResult
on the fragment
My first question is: is the Android API ready for those use cases? And then the main question is: how does it work? Because even with the Google reference, the only use case I have seen being described was the classic case. The other cases seem unclear to me, from what I have read on other questions about it.