Reputation: 14136
I have an ArrayList of custom Parcelable objects and I'm trying to save this list to external/internal data storage. These objects are called Lectures and each Lecture contains Arraylists of Assignments, Tests, Notes, and Settings. All of these implement Parcelable too.
Now I attempted to save to this to the sd card using:
for(Lecture l : lectureList)
oos.writeObject(l);
oos being the ObjectOutputStream. An exception is thrown (InvalidDataException? I don't remember) with the first write. Now I thought Parcelable was Android's own implementation of Serializable - but upon further reading it seems Parcelable might not be route to save objects persistently. Which is an issue becuase I use it for saveInstanceState.
So do I
Upvotes: 1
Views: 1092
Reputation: 14136
In case anybody cares... I ended up implementing Serializable with Parcelable and it works just fine for both persistent and restoring the state of my app.
Upvotes: 4