I have an Activity
that handles many Fragments
, and, for backstack
management, I have a custom stack, where I manage show / hide for Fragments
. My code and navigation work perfectly.
Right now, I am implementing the application theme change by a Button
in the Configuration Fragment
. For this I am using the method Activity.Recreate (); for the change of the theme and, the data of the Configuration Fragment is retained with the same data and the theme of the application changes perfectly, but the BackStack of Fragments disappears, reason why, when pressing the back button, it leaves the application, instead of sending me back to the Fragment or Previous Activity, from where I accessed the Configuration Fragment
.
What is the best way to maintain the backstack of my Activity? This is possible?
Important: only when Activity.Recreate();
is called, because if the Activity is destroyed by any other way, I do not want the BackStack back, I want my Activity clean.
Additional:
- The orientation setting of my application is in portrait mode.
- The
launchMode
of my Activity issingleTask
, it must be so for the type of application I am doing.