Android Parcelable

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Introduction

Parcelable is an Android specific interface where you implement the serialization yourself. It was created to be far more efficient that Serializable, and to get around some problems with the default Java serialization scheme.

Remarks

It is important to remember that the order in which you write fields into a Parcel MUST BE THE SAME ORDER that you read them out from the parcel when constructing your custom object.

The parcelable interface has a strict 1 MB size limit. That means that any object, or combinations of objects, you put into a parcel that take up over 1MB of space will become corrupted on the other side. This can be hard to discover, so keep in mind what kind of objects you plan to make parcelable. If they have large dependency trees, consider another way in which to pass data around.



Got any Android Question?