I switched from a singleton to an application object to store application data because as I understood it, there was a much better chance of my cached data surviving in an application object, than in a regular singleton.
I am still having issues however. If I switch to several other apps, and come back to my app, the call to load my event after i’ve loaded getApplication() is throwing an null pointer exception.
What I find even more bizarre, is that the bundle from my original intent, is still active and has survived the application switching.
How can I keep data, which doesn’t necessarily need to be persisted in a permanent way (if the entire application were killed, and reloaded, it would just pull it down from the webservice and start fresh, this is why I thought switching to an application object would be ok )
Are you looking to persist data relating to when your application is put into the background by the user, and then brought back?
Perhaps overriding the methods onSaveInstanceState and onRestoreInstanceState, and storing and recovering from a bundle is what you are looking for.
http://developer.android.com/reference/android/app/Activity.html#onRestoreInstanceState(android.os.Bundle)
http://developer.android.com/reference/android/app/Activity.html#onSaveInstanceState(android.os.Bundle)
You may then want to define a Parcelable interface
http://developer.android.com/reference/android/os/Parcelable.html
on the classes you wish to store.
Alternatively You may also use the shared preferences api.
http://developer.android.com/reference/android/content/Context.html#getSharedPreferences(java.lang.String, int)