I have an Activity A that starts Activity B:
activityA.startActivityForResult(new Intent(activityA, B.class), REQUESTCODE_B);
At a button click in Activity B, a method is executed that starts Activity C from A. I.e.
activityA.startActivityForResult(new Intent(activityA, C.class), REQUESTCODE_C);
At a button click in Activity C, it is closed by calling finish(), while B remains active.
Now I would expect activityA’s onActivityResult() method to be called, but it is only called after activityB finishes. I can imagine that this is by design, but is there a way to directly let activityA know that activityC has finished? And without Activity B or C having to explicitly know about A?
This is very bad practice. When you starts ActivityC you can’t be sure that ActivityA is not destroyed by Android. Android can destroy background activities at any time. When you call ActivityC.finish(), ActivityA probably does not exists. Then, when you call ActivityB.finish(), Android creates ActivityA from activities stack and call onActivityResult() method for finished activities (I don’t sure in which order). Tell us the reason why you couldn’t return result from ActivityC to ActivityB.