1.

In Android application how you will transfer Object like complex POJO code from one Activity to another? Hint: What is the difference between Serializable and Parcelable?

Answer»

When you need to send Object from one activity to another activity, we are using TWO techniques: 1. Serialization and 2. Parcelable. In other case passing data from one activity to another activity, we are using Intent. Parcelable is a FASTER approach compared to Serialization because it is using Android SDK.

There are some reasons also:

  • Serialization is a marker interface as it converts an object into a STREAM using the Java reflection API. Due to this, it ends up creating a NUMBER of garbage objects during the stream conversation process.
  • Parcelable is in the Android SDK; serialization, on the other hand, is available in Java. So Android developers prefer Parcelable over the Serialization technique.


Discussion

No Comment Found

Related InterviewSolutions