Passing ArrayList Objects through Bundle? [duplica

2019-08-01 10:42发布

问题:

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.