tutorial, no_image, android,

Android - no_image

Upendra Upendra Follow Jan 23, 2025 · 1 min read
Android - no_image
Share this

Serializable vs Parcelable

Serializable

Serializable is a standard Java interface. For the serializable class just implement the Serializable interface and add override methods. This approach is a slow process. Its create a lot of temporary objects and a bit of garbage collection but the serializable interface is easier to implement. Java will automatically serialize it in certain situations.

Parcelable

Parcelable is another interface. Despite its rival (Serializable in case you forgot), it is a part of the Android SDK. Now, Parcelable was specifically designed in such a way that there is no reflection when using it. That is because we are being really explicit for the serialization process.

Conclusion

  • Parcelable is faster than Serializable interface
  • Parcelable interface takes more time to implement compared to Serializable interface (with Kotlin this is not true)
  • Serializable interface is easier to implement
  • Serializable interface creates a lot of temporary objects and causes quite a bit of garbage collection

https://docs.oracle.com/javase/7/docs/api/java/io/Serializable.html https://developer.android.com/reference/android/os/Parcelable.html
https://android.jlelse.eu/parcelable-vs-serializable-6a2556d51538

credit goes to @swayangjit
Join Newsletter
Get the latest news right in your inbox. We never spam!
Upendra
Written by Upendra Follow
Hi, I am Upendra, the author in Human and machine languages,I don't know to how 3 liner bio works so just Connect with me on social sites you will get to know me better.