Objectives :
- What is Parcelable?
- What is Serializable?
- What are the differences between Parcelable and Serializable?
- Explain : Parcelable Vs. Serializable
- What is Parcelable and Serializable in Android?
Parcelable Vs. Serializable
Parameter |
Parcelable | Serializable |
What is it? | Google developped Parcelable for better performance on android | Serializable is a standard Java interface |
Purpose | For marshaling and unmarshaling Java objects | For marshaling and unmarshaling Java objects |
Package | android.os | java.io |
Speed | 10 times Faster than Serializable because it is optimized for usage on android development | Slower than Parcelable |
Implementation Time | Requires more time than Serializable | Requires very less time as compared to Parcelable |
Degree of Implementation | Difficult | Easier than Parcelable |
Memory | Less temporary objects | Serializable interface create a lot of temporary objects and cause quite a bit of garbage collection |
Use with Intent | Parcelable array can be pass via Intent in android |
Cannot be used with Intent |