1

I have three activities A, B and C. Suppose A starts B and B starts C with startsActivity().

Stack becomes A, B, C.

Now suppose, C makes B to come to front by using startActivityForResult() and passing FLAG_ACTIVITY_REORDER_TO_FRONT.

Stack becomes A, C, B.

In B, I have written this code:

override fun onBackPressed() {
    setResult(RESULT_DESTROY_C)
    super.onBackPressed()
}

I am expecting that C's onActivityResult() would be called after back button on B is pressed. But it is not getting called. Why? Please help.

Please note that this is not duplicate of this question. Scenario of my question is different.

Malwinder Singh
  • 6,644
  • 14
  • 65
  • 103
  • Why on back press of B will call onActivityResult for C? Since A -> B -> C, C's back press will call B, right? share how you are starting Activity B and C and their on back press? – TheAnkush Jun 01 '19 at 15:21
  • I used `FLAG_ACTIVITY_REORDER_TO_FRONT ` when C starts B with `startActivityForResult()`. So stack becomes: A, C, B. That's why I am expecting `onActivityResult()` of C to be called. – Malwinder Singh Jun 01 '19 at 15:23

0 Answers0