Android - 捆绑 List时使用打包还是序列化?

发布于 2024-10-07 00:24:00 字数 159 浏览 0 评论 0原文

应该如何将 List 从主活动正确传递到辅助活动?

据我了解,捆绑数据有两种方法:ParcelingSerializing。各自的优点和缺点是什么?

谢谢

How should List<MyClass> be properly passed from the main activity to a secondary activity?

From what I understand, there are two ways to bundle data: Parceling and Serializing. What are the pros and cons to each?

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

灼痛 2024-10-14 00:24:00

Parcelable 比 Serialized 快得多——我上次检查过,至少快一个数量级。另一方面,它确实需要您做更多的工作,因为它不会自动执行操作。但这就是它速度如此之快的原因之一。 :)

一般来说,我强烈建议远离 Serialized。

Parcelable is significantly faster than Serializable -- last I checked, at least an order of magnitude. On the other hand, it does require more work from you, since it doesn't do things automatically. But that is one of the reasons it is so much faster. :)

Generically I strongly recommend staying away from Serializable.

江南烟雨〆相思醉 2024-10-14 00:24:00

anddev 上的这个链接可能会给你详细的答案
http://www.anddev.org/bundle_vs_parcel_vs_message-t517.html

还有一个关于同一主题的更多文章。它在这里
http://www.mooproducts.org/node/6?page=57

This link on anddev might give you answer in details
http://www.anddev.org/bundle_vs_parcel_vs_message-t517.html

Also there is one more article on the same topic. Its here
http://www.mooproductions.org/node/6?page=57

美人如玉 2024-10-14 00:24:00

检查 Android 开发者网站, ParcelParcelable可序列化

Check the android developer site, Parcel , Parcelable and Serializable

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文