

There are two methods to override from Parcelable interface describeContents and writeToParcel. This is a simple object which keeps user related data. Then object capable to put in to an intent with intent.putExtra methodįollowing is an example implementation of parcelable object( User) When need to pass custom object between activities we can mark the object as Parcelable(Implement the Parcelable interface). 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.

Passing simple data types (String, int, double,…ect) between activities is easy.
