6

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 Answer 1

3

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

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks! I found a comprehensive answer : stackoverflow.com/questions/1441871/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.