Reputation: 3362
This is how I have organized my data:
Now the scenario that puzzles me: In a certain Activity If a button is pressed
when It returns though it seem that the application is destroyed because onCreate is called again but at that time the arrayList in my Application class is this time null. So my questions are
this Is how I've declared the ArrayList of objects in my Application class
private static ArrayList<PointOfInterest> pois;
EDIT: I put a Log.i() on onDestroy() of the Activity and it was never printed. But on When I returned from the Settings, onCreate() was called (without onDestroy having been called), how is that possible?
Upvotes: 0
Views: 157
Reputation: 589
Static fields can be nullified by the os when the application is in background. So they should always be restored.
Upvotes: 1