Hey @EricKuck, shouldn'tonRestoreInstanceState be called upon configuration changes? I can see onRestoreViewState being called, but not onRestoreInstanceState.
Here's the lifecycle I'm getting when for example rotating the device:
// Begin configuration change:
onSaveViewState
onSaveInstanceState
onDetach
onDestroyView
// Configuration change completed:
onCreateView
onRestoreViewState
onAttach
PS: I'm writing to the outState bundle during onSaveInstanceState.
The instance is not destroyed on config change, so there's no reason to
restore its state. Its state is still fully intact.
On Mon, Sep 3, 2018, 6:45 AM Matias Radzinski notifications@github.com
wrote:
Hey @EricKuck https://github.com/EricKuck, shouldn't
onRestoreInstanceState be called upon configuration changes? I can see
onRestoreInstanceState being called, but not onRestoreInstanceState.Here's the lifecycle I'm getting when for example rotating the device:
// Begin configuration change:
onSaveViewState
onSaveInstanceState
onDetach
onDestroyView// Configuration change completed:
onCreateView
onRestoreViewState
onAttachPS: I'm writing to the outState bundle during onSaveInstanceState.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/bluelinelabs/Conductor/issues/475, or mute the thread
https://github.com/notifications/unsubscribe-auth/AB8c8jWpyu3HEBP5HaO91Ou6lZwI6iFxks5uXTJ7gaJpZM4WXpcp
.
@EricKuck So onRestoreInstanceState will be called only when the instance if fully destroyed then? I'm assuming this will not happen if the user destroys the instance by exiting the app but only when the app is in background and the system destroys it due to low memory, right?
This is the primary case in which that would happen, but lifecycles in Android are pretty rough around the edges. If you're asking that question because you're thinking it would be easier to simply not handle that case, please ignore that inclination.
I only handle restoring the instance state in really business critical parts of my app like registration or in complex forms.
@EricKuck not all. Was just an example scenario. Agreed lifecycles are sometimes rough. Cheers and thanks for clarifying.