I'm a new comer to Android development and I happen to stumble upon these words:
- Serializable objects
- Serialization
- Parcelables
Please, what do these words mean and what are they used for?
I'm a new comer to Android development and I happen to stumble upon these words:
Please, what do these words mean and what are they used for?
Parcelable and Serialization are used for marshaling and unmarshaling Java objects.
Parcelable is well documented in the Android SDK; serialization on the other hand is available in Java. It is for this very reason that Android developers prefer Parcelable over the Serialization technique.
· In Parcelable, developers write custom code for marshaling and unmarshaling so it creates less garbage objects in comparison to Serialization. The performance of Parcelable over Serialization dramatically improves (around two times faster), because of this custom implementation.
· Serialization is a marker interface, which implies the user cannot marshal the data according to their requirements. In Serialization, a marshaling operation is performed on a Java Virtual Machine (JVM) using the Java reflection API. This helps identify the Java objects member and behavior, but also ends up creating a lot of garbage objects.
Due to this, the Serialization process is slow in comparison to Parcelable.
Check below link: very good explanation and example.
http://www.3pillarglobal.com/insights/parcelable-vs-java-serialization-in-android-app-development
from https://en.wikipedia.org/wiki/Serialization
In computer science, in the context of data storage, serialization is the process of translating data structures or object state into a format that can be stored (for example, in a file or memory buffer, or transmitted across a network connection link) and reconstructed later in the same or another computer environment.
There are different ways to make a java-class serializable. Among these are