安卓:Parcelable和序列化之间的区别? [英] Android: Difference between Parcelable and Serializable?

查看:134
本文介绍了安卓:Parcelable和序列化之间的区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么Android的提供2接口,序列化对象?不要序列化对象interopt与Android 文件夹和AIDL文件?

Why does Android provide 2 interfaces for serializing objects? Do Serializable objects interopt with Android Binder and AIDL files?

推荐答案

序列化是一个标准的Java接口。您只需标记一个类通过实现该接口可序列化,和Java将它在某些情况下会自动进行序列化。

Serializable is a standard Java interface. You simply mark a class Serializable by implementing the interface, and Java will automatically serialize it in certain situations.

Parcelable 是你自己实现序列化的Andr​​oid的特定接口。它的建立可以更加高效的序列化,并解决一些问题,默认的Java序列化方案。

Parcelable is an Android specific interface where you implement the serialization yourself. It was created to be far more efficient that Serializable, and to get around some problems with the default Java serialization scheme.

我相信,活页夹和AIDL工作,Parcelable对象。

I believe that Binder and AIDL work with Parcelable objects.

不过,您可以在意图使用序列化对象。

However, you can use Serializable objects in Intents.

这篇关于安卓:Parcelable和序列化之间的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆