title: Problem unmarshalling parcelables
body: <p>I've got a few classes that implement <a href="http://developer.android.com/reference/android/os/Parcelable.html" rel="noreferrer">Parcelable</a> and some of these classes contain each other as properties. I'm marshalling the classes into a <a href="http://developer.android.com/reference/android/os/Parcel.html" rel="noreferrer">Parcel</a> to pass them between activities. Marshalling them TO the Parcel works fine, but when I try to unmarshall them I get the following error:</p>
  
  <pre><code>...
  AndroidRuntime  E  Caused by: android.os.BadParcelableException: ClassNotFoundException when unmarshalling: schemas.Arrivals.LocationType
  AndroidRuntime  E   at android.os.Parcel.readParcelable(Parcel.java:1822)
  AndroidRuntime  E   at schemas.Arrivals.LayoverType.&lt;init&gt;(LayoverType.java:121)
  AndroidRuntime  E   at schemas.Arrivals.LayoverType.&lt;init&gt;(LayoverType.java:120)
  AndroidRuntime  E   at schemas.Arrivals.LayoverType$1.createFromParcel(LayoverType.java:112)
  AndroidRuntime  E   at schemas.Arrivals.LayoverType$1.createFromParcel(LayoverType.java:1)
  AndroidRuntime  E   at android.os.Parcel.readTypedList(Parcel.java:1509)
  AndroidRuntime  E   at schemas.Arrivals.BlockPositionType.&lt;init&gt;(BlockPositionType.java:244)
  AndroidRuntime  E   at schemas.Arrivals.BlockPositionType.&lt;init&gt;(BlockPositionType.java:242)
  AndroidRuntime  E   at schemas.Arrivals.BlockPositionType$1.createFromParcel(BlockPositionType.java:234)
  AndroidRuntime  E   at schemas.Arrivals.BlockPositionType$1.createFromParcel(BlockPositionType.java:1)
  ...
  </code></pre>
  
  <p>The <code>LayoverType</code> class (where it's failing):</p>
  
  <pre><code>public class LayoverType implements Parcelable {    
      protected LocationType location;
      protected long start;
      protected long end;
  
      public LayoverType() {}
  
      public LocationType getLocation() {
          return location;
      }
  
      public void setLocation(LocationType value) {
          this.location = value;
      }
  
      public long getStart() {
          return start;
      }
  
      public void setStart(long value) {
          this.start = value;
      }
  
      public long getEnd() {
          return end;
      }
  
      public void setEnd(long value) {
          this.end = value;
      }
  
  
      // **********************************************
      //  for implementing Parcelable
      // **********************************************
  
      @Override
      public int describeContents() {
          return 0;
      }
  
      @Override
      public void writeToParcel(Parcel dest, int flags) {
          dest.writeParcelable(location, flags);
          dest.writeLong(start);
          dest.writeLong(end  );
      }
  
      public static final Parcelable.Creator&lt;LayoverType&gt; CREATOR = new Parcelable.Creator&lt;LayoverType&gt;() {
          public LayoverType createFromParcel(Parcel in) {
              return new LayoverType(in);
          }
  
          public LayoverType[] newArray(int size) {
              return new LayoverType[size];
          }
      };
  
      private LayoverType(Parcel dest) {
          location = (LocationType) dest.readParcelable(null);    // it's failing here
          start = dest.readLong();
          end   = dest.readLong();
      }
  }
  </code></pre>
  
  <p>Here's the <code>LocationType</code> class:</p>
  
  <pre><code>public class LocationType implements Parcelable {
      protected int locid;
      protected String desc;
      protected String dir;
      protected double lat;
      protected double lng;
  
      public LocationType() {}
  
      public int getLocid() {
          return locid;
      }
  
      public void setLocid(int value) {
          this.locid = value;
      }
  
      public String getDesc() {
          return desc;
      }
  
      public void setDesc(String value) {
          this.desc = value;
      }
  
      public String getDir() {
          return dir;
      }
  
      public void setDir(String value) {
          this.dir = value;
      }
  
      public double getLat() {
          return lat;
      }
  
      public void setLat(double value) {
          this.lat = value;
      }
  
      public double getLng() {
          return lng;
      }
  
      public void setLng(double value) {
          this.lng = value;
      }
  
      // **********************************************
      //  for implementing Parcelable
      // **********************************************
  
  
      @Override
      public int describeContents() {
          return 0;
      }
  
      @Override
      public void writeToParcel(Parcel dest, int flags) {
          dest.writeInt   (locid);
          dest.writeString(desc );
          dest.writeString(dir  );
          dest.writeDouble(lat  );
          dest.writeDouble(lng  );
      }
  
      public static final Parcelable.Creator&lt;LocationType&gt; CREATOR = new Parcelable.Creator&lt;LocationType&gt;() {
          public LocationType createFromParcel(Parcel in) {
              return new LocationType(in);
          }
  
          public LocationType[] newArray(int size) {
              return new LocationType[size];
          }
      };
  
      private LocationType(Parcel dest) {
          locid = dest.readInt   ();
          desc  = dest.readString();
          dir   = dest.readString();
          lat   = dest.readDouble();
          lng   = dest.readDouble();
      }
  }
  </code></pre>
  
  <p><strong>Update 2</strong>: As far as I can tell it's failing at the following bit of code (from <a href="http://www.netmite.com/android/mydroid/frameworks/base/core/java/android/os/Parcel.java" rel="noreferrer">Parcel's source</a>):</p>
  
  <pre><code>Class c = loader == null ? Class.forName(name) : Class.forName(name, true, loader);
  </code></pre>
  
  <p>Why is it not able to find the class? It both exists and implements <code>Parcelable</code>.</p>