Save parcelable class into file

前端 未结 1 675
广开言路
广开言路 2021-01-15 06:12

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 sa

相关标签:
1条回答
  • 2021-01-15 06:52

    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.

    0 讨论(0)
提交回复
热议问题