What is Serializable and Parcelable?

  • Thread starter Thread starter Ashish Bisht
  • Start date Start date
AI Thread Summary
The discussion centers on the comparison between Serializable and Parcelable in Android development. Serializable is a marker interface that is easier to implement but is slower and generates more temporary objects due to its reliance on reflection. Parcelable, while more efficient and faster, requires additional boilerplate code to implement. Developers are advised to consider the trade-offs between speed and code complexity on a case-by-case basis. For those seeking a comprehensive understanding of both methods, consulting Android documentation is recommended.
Ashish Bisht
Messages
2
Reaction score
0
Hi everyone, i am an Android developer and want to know your views on Serializable and Parcelable. Which is best approach in Android that will be helpful for me ?
 
Technology news on Phys.org
Serializable is a marker interface, that you implement on a class and its children. The downside of this approach is that it's slow and creates a lot of temporary objects.

Parcelable is a more specialized interface, which is significantly faster than Serializable. The downside is that you have to write some - enough in many cases, boilerplate code.

Everything has its cost. If you can afford the time , then it's better to use Parcelable. On the other hand, in most cases the slowness of Serializable - that is due to reflection that is used, won't be particularly noticeable, so you can write significantly less code and be OK. In general, you have to judge yourself on a per case basis, if it worths the extra time or not.

I strongly recommend to look up Android documentation, in order to have a complete view about the two choices.
 
Last edited:
  • Like
Likes harborsparrow and Ashish Bisht
Hello Ashish, :welcome:

+1 for QQ. But I wonder why -- as an android aficionado -- you didn't simply google 'serializable vs parcelable' and ended up with D Phil ?
 
  • Like
Likes Ashish Bisht
Thank you everyone for valuable suggestion.
 
Thread 'Is this public key encryption?'
I've tried to intuit public key encryption but never quite managed. But this seems to wrap it up in a bow. This seems to be a very elegant way of transmitting a message publicly that only the sender and receiver can decipher. Is this how PKE works? No, it cant be. In the above case, the requester knows the target's "secret" key - because they have his ID, and therefore knows his birthdate.
Thread 'Project Documentation'
Trying to package up a small bank account manager project that I have been tempering on for a while. One that is certainly worth something to me. Although I have created methods to whip up quick documents with all fields and properties. I would like something better to reference in order to express the mechanical functions. It is unclear to me about any standardized format for code documentation that exists. I have tried object orientated diagrams with shapes to try and express the...
Back
Top