我如何将Object:ArrayList从一个Activity传递到另一个?
似乎意图不能容纳除ArrayList外的自定义内容。
作为一种破解,我使用了一个静态成员:
staticResultList = new ArrayList<SingleExamResult>(m_examResults);并通过以下方式获取以下活动:
m_examResults = DoExam.staticResultList;这显然不是正确的方式,任何“常见”方法? 非常感谢!
How can I pass a Object: ArrayList from one Activity to another?
Seems that intent cannot hold custom ones except ArrayList.
As a kind of hack, I use a static member:
staticResultList = new ArrayList<SingleExamResult>(m_examResults);and Get it in the following Activity by:
m_examResults = DoExam.staticResultList;It's not the correct way obviously, any 'common' approaches? Thanks a lot!
最满意答案
如果你想避免使用静态成员破解,你的自定义类SingleExamResult必须实现Parcelable接口:
http://developer.android.com/reference/android/os/Parcelable.html
If you want to avoid using the static member hack, your custom class, SingleExamResult, must implement the Parcelable interface:
http://developer.android.com/reference/android/os/Parcelable.html
更多推荐
发布评论