It is highly recommended to use Parcelable implantation when serializing objects in android The performance of Parcelable is very high when comparing to Serializable because of its custom implementation
So it creates less garbage objects in comparison to Serialization In Parcelable, developers write custom code for marshaling and unmarshaling. Parcelable is android own serialization protocol. So when object implements Serializable Java will automatically serialize it. Serializable is a marker interface, which implies the user cannot marshal the data according to their requirements. Parcelable (Implement object as Parcelable).Serializable (Implment object as Serializable).In android there are two ways to achieve marshaling and unmarshaling of java objects.Converting it back to its live, in-memory representation is called deserializing or unmarshaling. Serialization is converting data from a fast, efficient, internal representation to something that can be kept in a persistent store or transmitted over a network.Ĭonverting data to its serialized form is often called marshaling it. This is the place where serialization comes. We can just put the them to intent with unique key and send it to an another activity.īut it is bit complex when passing custom objects between activities. Passing simple data types (String, int, double,…ect) between activities is easy.