Benefit of using Parcelable instead of serializing object

From “Pro Android 2”

NOTE: Seeing Parcelable might have triggered the question, why is Android not using the
built-in Java serialization mechanism? 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 objects.

Also realize that Android provides two mechanisms that allow you to pass
data to another
process. The first is to pass a bundle to an activity using an intent,
and the second is to pass a
Parcelable to a service. These two mechanisms are not interchangeable and
should not be
confused. That is, the Parcelable is not meant to be passed to an
activity. If you want to start
an activity and pass it some data, use a bundle. Parcelable is meant to
be used only as part of
an AIDL definition.

Leave a Comment