I just read about saving the state of my Android app and stumbled upon onRetainNonConfigurationInstance. But while reading the documentation , I noticed this suggestion:
This function is called pure optimization, and you should not rely on its call.
So I'm wondering: when does it really make sense to use this method. If I cannot rely on its call, I need one more mechanism for transferring state anyway (which in my case will be some kind of serialization). Therefore, if I do not have any performance achievements, is there any reason why I should go onRetainNonConfigurationInstance?
If it were guaranteed to be triggered, I would love to use it, but if it is not, it looks useless.
Am I missing something? When do you use this method? How would you support a network connection or something like that?
Thanks!
android state
Philipp
source share