Hi, I implemented Parcelable on two of my classes, and one class contains instances of the other. I'm not sure how to read them back in. Here's an example:
public class Farm implements Parcelable { ArrayList<Horse> mHorses; // Horse implements parcelable too. @Override public void writeToParcel(Parcel out, int flags) { out.writeInt(mHorses.size()); for (Horse it : mHorses) { out.writeParcelable(it, flags); } } private Farm(Parcel in) { mHorses = new ArrayList<Horse>(); int numHorses = in.readInt(); for (int i = 0; i < numHorses; i++) { Horse horse = Horse.CREATOR.createFromParcel(in); mHorses.add(horse); } } } Is the way I'm reading them back in correct? Thanks -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en