One customer has sent me feedback about my app force closing on startup after he has killed the app with a Task Killer. I've told him task killers are dangerous and do not do anything good to the phone performance since Android does not manage RAM as Windows, but he won't uninstall the Task Killer.
The Force Close goes like this:
A) User uses my app normally
B) User task kills my app
C) User launches my app again
D) Force close on startup
E) User launches my app yet again
F) Everything works as intended
I've found the problem is that my static objects become null because they are cleared from RAM, leading to NullPointerExceptions that Force Close the app. However, I have a lot of places where I'm accessing those static objects (if this wasn't the case I wouldn't even use static objects) so the NullPointerExceptions can happen in a lot of places.
This behaviour only happens in Android 2.3.7 or lower. Android 4.0's own task killer (the one you can access by long-pressing Home) kills the app correctly and then launches it without any force closings.
How can I circumvent this behaviour?