title: how to properly implement Parcelable with an ArrayList<Parcelable>?
body: <p>I am having trouble making my class <code>Parcelable</code>.  The trouble is, I am trying to write to the parcel a member in the class which is an <code>ArrayList&lt;Parcelable&gt;</code> object. The <code>ArrayList</code> is <code>Serializable</code>, and the objects (<code>ZigBeeDev</code>) in the list are <code>Parcelable</code>.  </p>
  
  <p>Here is the relevant code:</p>
  
  <pre><code>package com.gnychis.coexisyst;
  
  import java.util.ArrayList;
  import java.util.Iterator;
  
  import android.os.Parcel;
  import android.os.Parcelable;
  
  public class ZigBeeNetwork implements Parcelable {
  
      public String _mac;             // the source address (of the coordinator?)
      public String _pan;             // the network address
      public int _band;               // the channel
      ArrayList&lt;Integer&gt; _lqis;       // link quality indicators (to all devices?)
      ArrayList&lt;ZigBeeDev&gt; _devices;  // the devices in the network
  
      public void writeToParcel(Parcel out, int flags) {
          out.writeString(_mac);
          out.writeString(_pan);
          out.writeInt(_band);
          out.writeSerializable(_lqis);
          out.writeParcelable(_devices, 0);  // help here
      }
  
      private ZigBeeNetwork(Parcel in) {
          _mac = in.readString();
          _pan = in.readString();
          _band = in.readInt();
          _lqis = (ArrayList&lt;Integer&gt;) in.readSerializable();
          _devices = in.readParcelable(ZigBeeDev.class.getClassLoader());  // help here
      }
  
      public int describeContents() {
          return this.hashCode();
      }
  
      public static final Parcelable.Creator&lt;ZigBeeNetwork&gt; CREATOR = 
              new Parcelable.Creator&lt;ZigBeeNetwork&gt;() {
          public ZigBeeNetwork createFromParcel(Parcel in) {
              return new ZigBeeNetwork(in);
          }
  
          public ZigBeeNetwork[] newArray(int size) {
              return new ZigBeeNetwork[size];
          }
      };
  
      //...
  }
  </code></pre>
  
  <p>I have marked two spots "// help here" to understand how to properly write to the parcel and how to reconstruct it.  If <code>ZigBeeDev</code> is <code>Parcelable</code> (properly tested), how do I do this properly?</p>