Sawan Kumar avatar

Kotlin Parcelize Power Features

tellmehowblog

Published: 13 Dec 2017 › Updated: 13 Dec 2017Kotlin Parcelize Power Features

Kotlin Parcelize Power Features

 You are going to delete lots of lines of code! Yes, it is not a clickbait!

How do you pass your model between activities?

  • Serializable?
  • EventBus / Otto ?
  • Parcelable?

Serializable = Reflection! Run Forest Run!!! It is terrible for Android performance. Bus libraries like EventBus or Otto are easy to use and have good performance but after some time they cause too much complexity in your code.

Parcelable interface is great for Android performance but it has too much boilerplate.

Parcelize 😍

Kotlin added parcelable support in version 1.1.4.Android Extensions plugin now includes an automatic Parcelable implementation generator. Declare the serialized properties in a primary constructor and add a @Parcelize annotation, and writeToParcel()/createFromParcel() methods will be created automatically.

Source 

Leave Kotlin Parcelize Power Features to:

Written by

Java and Android Developer

Read more #kotlin posts


Best Posts From Sawan Kumar

We have not curated any of tellmehowblog's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.

More Posts From Sawan Kumar