Restore Static Members In Android

When one performs the ‘Clean Memory’ option, it completely destroys all Static Members. Hence, one needs to reinitialize them to avoid any exception.

How to do that ?

OnSaveInstanceState() is an overridden method and used to store data before pausing the activity. The Bundle is a container to save all the information that one likes.

Given that onSaveInstanceState() gets called before activity is paused, this ensures that any information it needs, after that information is potentially destroyed, can be retrieved from the saved Bundle.