Proper way to know whether an Activity has been destroyed Proper way to know whether an Activity has been destroyed android android

Proper way to know whether an Activity has been destroyed


That will work, but sometimes the OS will go and shut your application down if it's inactive an amount of time when other applications need priority. For sure I know when that happens the variables will get nullified, not sure though if it would in your case using volatile which goes to main memory. But one way to be sure that you get the right value, is to save it in SharedPreferences.