Use onstop() callback method in Android to recover activity state if destroyed accidently

 Use onstop() callback method in Android to recover activity state if destroyed accidently

 

In android system, activity gets destroy in two scenarios.

 

 

1. When user press back button or write code in activity to destroy itself.
2. When activity is currently in paused/stopped state and it is not used in for a long time and current foreground activity requires more memory or resources.

 

(more…)