![]() Serializable interface is very easy to implement. ![]() Differences between Parcelable and Serializable However, if there’s large amounts of data Serializable tends to be slower than Parcelable. To check out how to pass objects between activities using Gson - TypeToken, go through this blog by theblackcat102Īs long as you have smaller amounts of data using any of these ways should be fine. Below is an example: public class User implements Serializable We just have to implement Serializable in the target object that is to be passed between activities and also in any of its member variables. ![]() The most popular ways of passing objects between activities turned out to be using either Serializable or Parcelable implementation for the object. There are claims that it’s slow when compared to Parcelable. But It seems to be not a best practice when I referred various resources online. I have been using Gson - TypeToken way to pass objects or list of objects between activities. Though there are various blog posts on this topic, this article portrays my understanding of many such resources. So I thought of writing a blog post on various ways to send data between activities. I get asked this question by new android developers.
0 Comments
Leave a Reply. |