ChavesJM
ChavesJM

Reputation: 183

Save parcelable class into file

I was using a serializable class for I save the xml parser result, but when I read that It is very slow in Android, I changed to parcelable class.

Now, I want to save the content parcelable class into file.

How can I do it?

Thanks. Regards.

Upvotes: 3

Views: 9893

Answers (1)

stinepike
stinepike

Reputation: 54692

According to Parcel API reference

Parcel is not a general-purpose serialization mechanism. This class (and the corresponding Parcelable API for placing arbitrary objects into a Parcel) is designed as a high-performance IPC transport. As such, it is not appropriate to place any Parcel data in to persistent storage: changes in the underlying implementation of any of the data in the Parcel can render older data unreadable.

Parcelable is meant for IPC use only and is not designed to be persisted. So you have to convert your object into some sort of persistable data structures like XML, JSON, Serializable.

Upvotes: 22

Related Questions