Passing ArrayList Objects through Bundle? [duplicate]

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-11 04:44:28

问题


Possible Duplicate:
Passing data of a non-primitive type between activities in android

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 ...

pls help me with the code ...

thanks :)


回答1:


Have you looked at the docs for Bundle? Android - Bundle docs

If your ArrayList contains simple values, you can use something like putIntArray in the src activity and getIntArray in the dest activity.

Otherwise your ArrayList objects will have to derive from Parcelable and you'll use the put/getParcelableArray methods accordingly.



来源:https://stackoverflow.com/questions/5084355/passing-arraylist-objects-through-bundle

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!