In my project, there are Activities and Fragments. And there's an Fragment backstack.
My question is how to save/restore the fragment stack in case of Activity is destroyed by the OS.
@forcewill are you taling about addToBackStack? Yes I did. I'm not talking about popup topmost fragment in case of back pressed. I'm talking about to restore the fragment stack in case of Activity destroyed.
@Derek, I did follow your way to write the following to every fragment and activity to override onStaveInstanceState(...)
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
}
But it seems like it's still not working.
I have tested on - Galaxy S3 with Android 4.1 - Emulator with Android 5.1 (to turn a debugging option named "Don't keep activity"
@josedlujan, it's not about save single Fragment instance, it's about save the fragments in stack.