0

I find a bunch of tutorial of serialize vs Parcelable etc. But I have this question : I have an object that implements Parcelable because I have to pass it through IPC. But this object should also be stored in a raw way in a db.

Is there a possibility to use the implementation form Parcelable to serialize it in a compatible way ? (I know marshallization, but as Android doc says : " [it] does not attempt to maintain compatibility with data created in different versions of the platform. ")

Note : I don't need any kind of reflection, I just would like to re-use the code from the Parcelable

hl037_
  • 3,520
  • 1
  • 27
  • 58
  • Serialization is magic. Just declare your object serializable, and it is. Then a basic DataOuputstream backed by a ByteArrayOutputStream suffice to get the byte[] representation of your object. – njzk2 Dec 23 '15 at 16:41
  • As [Android documentation](http://developer.android.com/intl/es/reference/android/os/Parcel.html#marshall%28%29) says: you should use serialization to store the object. Just use standard Java serialization. – m0skit0 Dec 23 '15 at 16:45

0 Answers0