Parcelable Vs Serializable

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 🙂

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s