In my app, I have a singleton class which communicates with all the activities and has all the app data.
All of a sudden the object has started becoming null.
It seems to be happening when i change top level activity (using intent).
Is there a simple method the make sure that as long as my activity is visible the object persists.
In my app, I have a singleton class which communicates with all the activities
Share
If it were me, I’d be using a
Serviceinstead of a singleton to manage app data that is shared across activities. It would be far more robust.See the Services Developer Guide for more information.