Assuming MyList is an object you'll need to make it implement
Parcelable and Serializable
There are then 2 functions that you'll need to set up
this is used to re-create the object at it's destination:
public static final Parcelable.Creator<MyList> CREATOR = new
Parcelable.Creator<MyList>() {
public MyList createFromParcel(Parcel in) {
MyList foo = new MyList();
foo.bar = in.readString();
return foo;
}
public MyList[] newArray(int size) {
return new MyList[size];
}
};
and this is used to actually parcel the object in the first place
public void writeToParcel(Parcel arg0, int arg1) {
arg0.writeString(this.bar);
}
I'm pretty sure you need to put items into the parcel in the same
order that you get them out, but don't quote me on that.
On Apr 7, 6:07 am, "a...@lg" <[email protected]> wrote:
> Hi all,
> I have an ArrayList<MyList> aList in an activity. I would like to send
> this data to another activty. Such that,
>
> ArrayList<MyList> aList;
>
> Intent intent = new Intent();
> intent.setClass(mainactivity.this, newActivity.class);
> intent.putExtra("MyList", aList );
> startActivity(intent);
>
> Will this work out..??
>
> On the receiving activity,
>
> Intent i = getIntent();
> newList = (ArrayList<MyList>) i.getSerializableExtra("MyList");
>
> But this gets me no where.... ERROR..!!!
>
> Please help me..how to approach this problem...
>
> My intention is to share this List between activities...
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---