Writing parcelables to Parcel
<p>I have a class that implements <code>Parcelable</code>. Three fields of this class are also <code>Parcelable</code> objects. When I write these fields to a Parcel, via dest.writeParcelable(mParcelableObject, 0) and try reading them back and setting the corresponding fields via <code>in.readParcelable(classLoader)</code> I get a <code>ClassCastException</code>. It seems that I cannot write multiple <code>Parcelables</code> to a <code>Parcel</code> and expect the system to figure out which of those Parcelables that were written correspond to which of my fields. In other words, if I write all of them and then read them in succession:</p>

<pre><code>someFieldOfTypeA = in.readParcelable(classLoader)
someFieldOfTypeB = in.readParcelable(classLoader)
someFieldOfTypeC = in.readParcelable(classLoader)
</code></pre>

<p>..then I can never succeed in writing to <code>someFieldOfTypeB</code> from <code>readParcelable</code>. The reading assumes that the type of this <code>readParcelable</code> is of class type A, the first one that I wrote to when I did <code>writeParcelable</code>. </p>

<p>I hope this makes any sense. </p>

<p>So how can I write multiple parcelables and then read them and assign them to their corresponding fields without getting a <code>ClassCastException</code>?</p>
