传递 ArrayList<MyObject>多个活动之间 [英] Passing ArrayList&lt;MyObject&gt; Between multiple Activities

查看:26
本文介绍了传递 ArrayList<MyObject>多个活动之间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在我的应用程序中的多个活动之间传递对象的 ArrayList.是否可以使用 setData() 方法使用 Intent 执行此操作?

I am trying to pass an ArrayList of Objects between multiple activities in my application. Is it possible to do this using an Intent using the setData() method?

推荐答案

如果你想发送一个对象的 ArrayList 那么你的类必须实现 ParcelableSerializable 接口.

If you want to send an ArrayList of objects then your class must implement the Parcelable or Serializable interface .

查看这些在活动之间发送自定义对象的好教程

See these good tutorials for sending custom object between Activities

http://androidideasblog.blogspot.in/2010/02/passing-list-of-objects-between.html

http://www.anddev.org/novice-tutorials-f8/simple-tutorial-passing-arraylist-across-activities-t9996.html

这篇关于传递 ArrayList<MyObject>多个活动之间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆