0

So right now I have a situation in which I have three fragments are committed in such an order:

Fragment A -> Fragment B -> Fragment C

Then, I start an Activity from Fragment C. The issue arises when I want to pop the back stack so the user is brought to Fragment B after the activity finishes. If I attempt to pop the back stack from the Activity before calling finish(), I get an IllegalStateException, saying that the action cannot be performed after onSaveInstanceState. Thus, is it even possible to make changes to the FragmentManager responsible for the fragments from the Activity?

myrocks2
  • 305
  • 3
  • 14
  • I am assuing you have activity1 owning the three fragments, and the third fragment opens up activity2. Then when you do backstacking you want to go from activity2 directly to fragmentB, am I right? – Juan Mendez Jul 28 '17 at 23:03
  • @JuanMendez almost, I have Fragment1 that owns the three sub-fragments, and the third sub-fragment opens up the Activity. And yes, when I call finish() on the Activity I want to be able to go directly back to sub-fragmentB. – myrocks2 Jul 28 '17 at 23:08

1 Answers1

1

How does this sound myrocks2? Android: how to make an activity return results to the activity which calls it?

First activity can start a second activity and expect a result. Upon getting back a result it knows second activity did its job, and now it's required to remove fragment c. (I don't know the logic of your app, but that can work)

Someone who thinks he is so smart gave you a negative vote, but I made sure to go away. There are no dumb questions.

Juan Mendez
  • 2,658
  • 1
  • 27
  • 23