【问题标题】:Passing ArrayList Objects through Bundle? [duplicate]通过 Bundle 传递 ArrayList 对象? [复制]
【发布时间】:2011-02-22 21:45:35
【问题描述】:

可能重复:
Passing data of a non-primitive type between activities in android

嗨... 在我的 android 中,我需要通过捆绑将 ArrayList 对象从第一个活动传递到第二个活动,并在第二个活动中检索相同的对象...

请帮我写代码...

谢谢:)

【问题讨论】:

标签: android eclipse arraylist bundles


【解决方案1】:

您查看过 Bundle 的文档吗? Android - Bundle docs

如果您的 ArrayList 包含简单的值,您可以在 src 活动中使用 putIntArray,在 dest 活动中使用 getIntArray。

否则,您的 ArrayList 对象将必须从 Parcelable 派生,您将相应地使用 put/getParcelableArray 方法。

【讨论】:

  • 你能给我一些示例代码吗....
猜你喜欢
  • 2016-12-03
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-11-22
  • 1970-01-01
  • 2012-07-08
  • 1970-01-01
  • 2011-07-19
相关资源
最近更新 更多