views:

76

answers:

1

Hi everyone!

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!

+1  A: 

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

Tyler
Thanks! I found a comprehensive answer : http://stackoverflow.com/questions/1441871/passing-data-of-a-non-primitive-type-between-activities-in-android
herbertD