Hi I'm beginner developer of Android :) I want to send ArrayList<Custom>
value from Activity
to Fragment
. I know that have to use Bundle
, but I don't know what's method can help me.
putSerializable
and putParcelable
?putParcelableArrayList
or putSerializable
?Thanks all that give me opportunity to grow :)
Serializable
and Parcelable
are both an interface. The former is as ancient as java. It allows you to store/write an object in a persistent way. The beauty of it is that you just have to implement the interface. The latter, Parcelable
, is android specific. It is faster than Serializable
, but you will have to implement the method of the interface to be able to use it.
What is different of putSerializable and putParcelable
putSerializable
accepts objects that implement Serializable
, putParcelable accepts objects that implement Parcelable
In my situation, Which method can help me putParcelableArrayList or putSerializable?
It is difficult to say. Generally speaking I would say Parcelable
Generally speaking, Parcelable
are way more faster than Serializable
. Here is a great article if yout want to learn more about it http://www.developerphil.com/parcelable-vs-serializable/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With