I've recently started Android programming and have run into many problems, but have been able to solve all except this one. For the sake of simplicity, I'll try to sum up what is happening.
- I have a MainActivity, which has a static ArrayList
- I go into a sub-activity, where I change the value of the ArrayList of MainActivity
- I leave the sub-activity, entering MainActivity
- I check the value of this ArrayList, and it now contains null values
Putting Logcat statements before and after the super.oncreate() call in MainActivity.onCreate(), I can see that some part of super.onCreate() changes the previous correct values in the ArrayList to null.
In case it is important, this static ArrayList contains custom (serializable) objects, each of which contains an ArrayList of custom (serializable) objects whose values themselves are null.
If that's confusing, I'll try to represent it in pseudo-code:
static ArrayList<CustomObject>
CustomObject{
ArrayList<OtherCustomObject> //values of this ArrayList become null
}
Of course if more information is needed, I will try to provide as much as I can.