通过捆绑传递ArrayList的对象? [英] Passing ArrayList Objects through Bundle?
问题描述
可能重复:结果
<一href=\"http://stackoverflow.com/questions/1441871/passing-data-of-a-non-primitive-type-between-activities-in-android\">Passing在android系统活动之间的非基本类型的数据。
Possible Duplicate:
Passing data of a non-primitive type between activities in android
喜...
在我的机器人我需要通过束从第一活动传递ArrayList对象到第二活动并且在第二活动检索相同对象...
hi... In my android i need to pass ArrayList object from first activity to a second activity through bundles and retrieve the same object in the second activity ...
请帮我code ...
pls help me with the code ...
感谢:)
推荐答案
你有没有看的文档进行捆绑? Android的 - 捆绑文档
Have you looked at the docs for Bundle? Android - Bundle docs
如果您ArrayList包含简单的值,可以使用类似putIntArray在DEST活动的SRC活动和getIntArray。
If your ArrayList contains simple values, you can use something like putIntArray in the src activity and getIntArray in the dest activity.
否则,您的ArrayList对象将具有Parcelable派生,你会使用相应的认沽/ getParcelableArray方法。
Otherwise your ArrayList objects will have to derive from Parcelable and you'll use the put/getParcelableArray methods accordingly.
这篇关于通过捆绑传递ArrayList的对象?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!