After rotating a device, any fragment we have on the backstack or in the fragmentSupportManager, activates the onSaveInstanceState.
However, after the first rotation, everything inside is null (all variables) and the app crashes with null pointer exceptions.
I'm wondering why if the fragment is virtually destroyed to nothing (all values are null) why the fragment still exists and onSaveInstanceState is being called?
My code is quite deep, with multiple base classes, and presenter classes to lift a lot of the code out of the fragments. I'm also only using one Activity and using fragmentTransaction.replace.
I can add code if people require it, but there's a lot! I'm hoping there is something obvious or something that I don't understand about the way the backstack works/retains it's fragments.
links I have looked at that haven't helped are
Will onSaveInstanceState be called on fragments in the back stack?
Once for all, how to correctly save instance state of Fragments in back stack?
Using onSaveInstanceState with fragments in backstack?
BackStack Fragments blank on rotation
Save state of fragments in backstack