title: How to pass List of custom object using intent as I am getting error using Serializable
body: <p>I have a list of object and I want to pass it through intent. I have implemented Serializable as well but app is crashing. </p>
  
  <pre><code>public class YoutubePlaylist implements Serializable{
  
  @SerializedName("message")
  @Expose
  private String message;
  @SerializedName("name")
  @Expose
  private String name;
  @SerializedName("playlist_id")
  @Expose
  private String playlistId;
  
  public String getMessage() {
      return message;
  }
  
  public void setMessage(String message) {
      this.message = message;
  }
  
  public String getName() {
      return name;
  }
  
  public void setName(String name) {
      this.name = name;
  }
  
  public String getPlaylistId() {
      return playlistId;
  }
  
  public void setPlaylistId(String playlistId) {
      this.playlistId = playlistId;
  }}
  </code></pre>
  
  <p>The error that I am getting is:</p>
  
  <pre><code>FATAL EXCEPTION: main
                                                                     Process: com.osolutions.news24, PID: 28944
                                                                     java.lang.RuntimeException: Parcel: unable to marshal value com.osolutions.news24.pojo.Item@7ffb401
                                                                         at android.os.Parcel.writeValue(Parcel.java:1418)
                                                                         at android.os.Parcel.writeList(Parcel.java:759)
                                                                         at android.os.Parcel.writeValue(Parcel.java:1365)
                                                                         at android.os.Parcel.writeMapInternal(Parcel.java:662)
                                                                         at android.os.Parcel.writeMap(Parcel.java:646)
  </code></pre>
  
  <p>I am passing like this in the following class:</p>
  
  <pre><code>public class YoutubeHorizontalPlaylistAdapter extends RecyclerView.Adapter&lt;YoutubeHorizontalPlaylistAdapter.ViewHolder&gt; {
  
  
  private Context context;
  private List&lt;Item&gt; itemList;
  private ArrayList&lt;YoutubePlaylist&gt; body;
  private HashMap&lt;String, List&lt;Item&gt;&gt; titleAndVideos;
  
  public YoutubeHorizontalPlaylistAdapter(Context context,
                                          List&lt;Item&gt; itemList ,List&lt;YoutubePlaylist&gt; body, HashMap&lt;String, List&lt;Item&gt;&gt; titleAndVideos) {
      this.context = context;
      this.itemList = itemList;
      this.body = (ArrayList&lt;YoutubePlaylist&gt;) body;
      this.titleAndVideos = titleAndVideos;
  }
  
  
  @Override
  public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
      View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.single_episode_item, null);
      return new ViewHolder(v);
  }
  
  @TargetApi(Build.VERSION_CODES.JELLY_BEAN)
  @Override
  public void onBindViewHolder(final ViewHolder holder, final int position) {
      holder.episodeNameTxt.setText(itemList.get(position).getSnippet().getTitle());
      String imagepath = itemList.get(position).getSnippet().getThumbnails().getHigh().getUrl();
      UrlImageViewHelper.setUrlDrawable(holder.episodeImg, imagepath, R.drawable.placeholder_logo, 300000);
      holder.itemView.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View view) {
              if (NetworkUtil.isOnline(context)) {
                     //
                  Bundle bundle = new Bundle();
                  bundle.putSerializable("title_body",body);
  
                  Intent i = new Intent(context, YoutubePlayListAdapter.class);
                  i.putExtra("hashmap", titleAndVideos);
                  i.putExtras(bundle);
  
                  i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
                  context.startActivity(i);
              } else {
                  CustomAlertDialogManager.noInternetDialog(context);
              }
          }
      });
  
  }
  
  @Override
  public int getItemCount() {
      return itemList.size();
  }
  
  public static class ViewHolder extends RecyclerView.ViewHolder {
  
      View v;
      private TextView episodeNameTxt;
      ImageView episodeImg;
  
  
      public ViewHolder(View itemView) {
          super(itemView);
          episodeNameTxt = itemView.findViewById(R.id.episode_name);
          episodeImg = itemView.findViewById(R.id.episode_img);
          v = itemView;
  
      }
  
  }}
  </code></pre>
  
  <p>Note: I am type casting the arraylist in the constructor. I have already tried other solutions from Stack Overflow but could not get any solution out of it.</p>