In Android as you are aware, we cannot just pass object to activities. Object must be implement either serializable or parcelable Interface for passing objects to activites.
Serializable:
- Java standard interface
- Easy to implement
- uses lot of temporary variable and its uses quite lot of garbage collection.
Parcelable:
- Android specific. It turns out that the Android team came to the conclusion that the serialization in Java is far too slow to satisfy Android’s interprocess-communication requirements. So the team built the Parcelable solution. The Parcelable approach requires that you explicitly serialize the members of your class, but in the end, you get a much faster serialization of your object.
- do need to add some custom implementation. so some might feel its hard to implement. We will talk about it later.
I have come across a good article which talks in detail about the parcelable Vs Serializable.
Refer the link: http://www.developerphil.com/parcelable-vs-serializable/
reg the topic of parcelable hard to implement, you can very well use Android parcelable code generator plugin to make your life easy. refer the screenshot below.
Happy coding 🙂
[…] Source: Parcelable Vs Serializable […]
LikeLike