Android Studio tip 1— Parcelable

Federico Palmieri
AndroidPub
Published in
2 min readJan 25, 2017

--

Finally, I decided to start my own tech blog and I thought it was a very good start to publish a series of posts describing one Android Studio plugin for each of them that are helping in my day-to-day development.

If you don’t know how to install a plugin in Android Studio then follow this link.

Android Parcelable code generator

Have you ever had to forward data between two activities/fragments?

If so, you’re familiar with the usage of the Bundle class and you know that you can only put a specific type of items in it.

But what if I want to forward an entire object? Then, that object will need to implement either Serializable or Parcelable interface. The first of the two requires very little effort for a developer and, in the first instance, it seems to be the way to go. But, as this clever post explains, using Parcelable interface is much more efficient. The drawback that comes with the latest is that it requires a bit of code and might not be so straightforward at first impact.

This is where “Android Parcelable code generator” plugin plays his role. You can let this plugin generate the boilerplate required to implement the Parcelable interface.

How to do it? Here it is:

If anyone is using Kotlin, then there is a specific plugin for it named “Parcelable Code Generator(for kotlin)”.

That’s it for now. Stay tuned for the next article!

--

--

Federico Palmieri
AndroidPub

Software engineer. Tech enthusiast, football fan, beer lover.