what is difference between Parcelable and Serialization used in android

后端 未结 5 899
北恋
北恋 2020-12-14 06:33

I want to know exact ,

  1. whether should I used parcelable or serialization technique for sending data from one activity to other?
5条回答
  •  南笙
    南笙 (楼主)
    2020-12-14 07:10

    Java Serializable:- Serializable comes from standard Java and is much easier to implement all you need to do is implement the Serializable interface and add override two methods.
    The problem with Serializable is that it tries to appropriately handle everything under the sun and uses a lot reflection to make determine the types that are being serialized. So it becomes a beefy Object.

    Androids Parcelable:- Android Inter-Process Communication (AIPC) file to tell Android how is should marshal and unmarshal your object.It is less generic and doesn't use reflection so it should have much less overhead and be a lot faster.

    Read More from http://www.3pillarglobal.com/blog/parcelable-vs-java-serialization-android-app-development

提交回复
热议问题