Passing ArrayList Objects through Bundle? [duplica

2019-08-01 10:21发布

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条回答
男人必须洒脱
2楼-- · 2019-08-01 10:57

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.

查看更多
登录 后发表回答