title: Use of ClassLoader in parcelable.readArrayList() in Android
body: <p>I've got a Class named as FilterData which implements Parcelable. I had a member variable <code>private ArrayList&lt;String&gt; listPropertyType;</code> When implementing the parcelable interface in my class, <code>parcel.readArrayList(null)</code> ,the parameter is shown as <code>ClassLoader object</code>. With this member variable the <code>FilterData</code> class works as intended. But I wanted to implement a scenario where <code>ClassLoader object</code> is passed to <code>readArrayList()</code> method.</p>
  
  <p>So what I've gathered from the documentation which is unclear about the <code>public ArrayList readArrayList (ClassLoader loader)</code> that if the <code>ArrayList</code> contains non primitive class ,we have to use <code>ClassLoader</code>.</p>
  
  <p>What's the use case in this scenerio of using a ClassLoader and how to use it? I wanted to use the ClassLoader in the following matter. Added a member variable  <code>private ArrayList&lt;RandomClass&gt; listRandom;  RandomClass randomClass;</code> to implement this.</p>
  
  <p>My <code>FilterData</code> class holds :</p>
  
  <pre><code>public FilterData(Parcel parcel)
  {
      listPropertyType=parcel.readArrayList(null);
      listRandom=parcel.readArrayList(randomClass);
  }
  
  
  
   @Override
  public void writeToParcel(Parcel parcel, int i) {
      parcel.writeList(listPropertyType);
      parcel.writeList(listRandom);
  }
  </code></pre>
  
  <p>And my RandomClass is :</p>
  
  <pre><code>public class RandomClass extends ClassLoader{
  
  //this class is for testing classloader in ArrayList in parcelable .readArrayList()
  
  String name;
  int age;
  
  public RandomClass(String name, int age) {
      this.name = name;
      this.age = age;
  }
  }
  </code></pre>
  
  <p>This implementation doesn't work. So how to use this?</p>