lundi 12 mars 2018

How to Handle OnResume for Multiple Fragments in stack with a single Activity

I have a scenario where in a single Activity will have 5 fragments added(not replaced)upon each other to stack. When the Activity was resumed i noticed the OnResume of all the fragments getting called, which I think is as per the Lifecycle.

If I am handling any data or doing UI changes based on the data passed from previous fragment in the OnResume of any of my Fragments they will also get initialized. Is there any design patten or any way to handle this particular case? That is when the Activity is resumed the OnResume of the fragments that are down the stack must not be called.

Aucun commentaire:

Enregistrer un commentaire