title: Why I got this error java.util.ArrayList cannot be cast to android.os.Parcelable
body: <p>I am getting error on this code</p>
  
  <pre><code>    listObjects = (Listitem) extras.getParcelable(OBJECT_LIST);
  </code></pre>
  
  <p>this is how I pass intent</p>
  
  <pre><code> Intent intent = new Intent(mcontext,SingleObjectActivity.class);
  
                  intent.putParcelableArrayListExtra("Object_list", personArrayList);
  
                 // intent.putExtra("Object_list", personArrayList);
                  intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                  mcontext.startActivity(intent);
  </code></pre>
  
  <p>this is second activity</p>
  
  <pre><code>public class SingleObjectActivity extends Activity
  {
      public static final String OBJECT_LIST = "Object_list";
      private ArrayList&lt;Listitem&gt; Objects;
      public ImageView imgview;
      private Listitem listObjects;
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.singleobject);
  
         // ArrayList&lt;Listitem&gt; items = getIntent().getParcelableArrayListExtra("Object_list");
          Bundle extras = getIntent().getExtras();
  
          imgview = (ImageView) findViewById(R.id.funnyimage);
  
      /*    if (extras != null) {
              Objects = extras.getParcelableArrayList(OBJECT_LIST);
          } else {
              Objects = new ArrayList&lt;Listitem&gt;();
          }
  */
  
          if (extras.containsKey(OBJECT_LIST)) {
  
              this.listObjects = (Listitem) extras.getParcelable(OBJECT_LIST);
            //  this.listObjects = extras.getParcelable(ARG_PERSON_LIST);
          } else {
              this.listObjects = null;
          }
  
  
          if (this.listObjects != null) {
              Picasso.
                      with(getApplicationContext()).
                      load(this.listObjects.getUrl())
                              //load()
                      .placeholder(R.drawable.logo)
                      .fit()
                      .noFade()
                      .into(imgview);
  
          }
      }
  }
  </code></pre>
  
  <p>This is listitem</p>
  
  <pre><code>public class Listitem implements Parcelable {
      private int order;
      private String id;
      private String url;
      private String userName;
      private int likes;
      //String name;
  
     public Listitem(Parcel in){
          this.id = in.readString();
          this.url = in.readString();
         //   this.name = in.readString();
  
      }
  
  
      public Listitem(int order, String id, String url, String userName, int likes) {
          this.id = id;
          this.url = url;
         this.userName = userName;
         this.order = order;
         this.likes = likes;
      }
  
      @Override
      public int describeContents() {
          return 0;
      }
  
      public void setUrl(String url) {
          this.url = url;
      }
  
      public String getUrl() {
          return url;
      }
  
      public void setId(String id) {
          this.id = id;
      }
  
      public String getId() {
          return id;
      }
  
  
      public int getLikes() {
          return likes;
      }
  
      public void setLikes(int likes) {
          this.likes = likes;
      }
      @Override
      public void writeToParcel(Parcel dest, int flags) {
          dest.writeString(this.id);
          // dest.writeString(this.name);
          dest.writeString(this.url);
  
      }
  
      public static final Parcelable.Creator&lt;Listitem&gt; CREATOR = new Parcelable.Creator&lt;Listitem&gt;() {
          public Listitem createFromParcel(Parcel in) {
              return new Listitem(in);
          }
  
          public Listitem[] newArray(int size) {
              return new Listitem[size];
          }
      };
  
      public String getUserName() {
          return userName;
      }
  
      public void setUserName(String userName) {
          this.userName = userName;
      }
  
      public int getOrder() {
          return order;
      }
  
      public void setOrder(int order) {
          this.order = order;
      }
  </code></pre>