Is there a way to pass an ArrayList of objects between activities? The
myObject implements Parcelable and I'm able to successfully pass the
objects around individually, but that means I need to have an exact
amount of "myObjects" coded. I want this to dynamically grow/shrink by
what the user does with the app.
I have seen some posts on the web about doing:
Activity A
ArrayList<myObject> myObjArray = new ArrayList<myObject>();
Then when passing this into the intent I would use:
intent.putParcelableArrayListExtra("myObjArray", myObjArray);
Activity B
ArrayList<myObject> myObjArray = new ArrayList<myObject>();
Bundle extras = getIntent().getExtras();
myObjArray = extras.getParcelableArray("myObjArray");
However, the myObjArray always gets filled with "null". How can I
achieve this? Thanks.
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en