Use parcelable to store item as sharedpreferences?

前端 未结 3 1078
谎友^
谎友^ 2021-02-05 04:26

I have a couple objects, Location, in my app stored in an ArrayList and use parcelable to move these between activities. The code for the object looks like this:



        
3条回答
  •  栀梦
    栀梦 (楼主)
    2021-02-05 04:45

    From documentation of Parcel:

    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.

提交回复
热议问题