更新时间:2022-12-08 21:13:15
捆绑
通过的方式意图#putExtra
没有任何功能添加一个对象
。您只能通过在 Parcelable
或Serializable$c$c>目的。你想通过意图通过任何物体
必须实现这些接口中的一个。它的建议落实 Parcelable
有一个简短的指南在这里:通行证通过使用parcelables的值参数。
Bundle
by way of Intent#putExtra
does not have any function to add an Object
. You can only pass in a Parcelable
or a Serializable
object. Any object you want to pass via an Intent
must implement one of those interfaces. It's recommended to implement Parcelable
there is a brief guide here: Pass by value Parameters using Parcelables.
另外这个问题有更多的有用的答案:How从一个Android的活动将对象到另一个使用意图?
Also this question has more helpful answers: How to send an object from one Android Activity to another using Intents?