static variable null when returning to the app

This is standard behavior in most mobile operating systems, definitely including Android. Your app is in fact very often killed if some other application with higher priority (generally, if it’s in the foreground it’s higher priority) needs the resources. This is due to the nature of mobile devices having relatively limited resources.

You should save your data somewhere more durable. You might find this article on general Data Storage to be useful. This question should be relevant too: Saving Android Activity state using Save Instance State

Note that this is in fact not a one-out-of-six device problem. This is a “problem” on all devices, it’s just more apparent on one of your devices probably because it has less memory. If you run a very memory-intensive app on any of your other devices you should see the same behavior. Also there is no flag to prevent this. This is standard and expected.

Leave a Comment