title: How do I pass arraylist of a custom object from one java class to another?
body: <p>I have an <code>Arraylist</code> of custom objects. I am trying to pass it from one java file to another. I tried the <code>putExtra</code> method and the <code>Parcelable</code> option; but I'm unable to understand <code>Parcelable</code>. </p>
  
  <p>Here's my custom object:</p>
  
  <pre><code>public class AddValues implements Serializable{
      public int id;
      String value;
  
      public AddValues(int id, String value)
      {
          this.id = id;
          this.value = value;
      }
  
      @Override
      public String toString() {
          String result = "id = "+id+","+" value = "+value;
          return result;
      }
  
      public  int getid()
      {
          return  this.id;
      }
  
      public String getvalue()
      {
          return this.value;
      }
  }
  </code></pre>
  
  <p>And here's my code to send the <code>ArrayList</code>:</p>
  
  <pre><code>Intent intent = new Intent(BluetoothLeService.this,HomePageFragment.class);
  intent.putExtra("id", data_id);
  intent.putExtra("value", list);
  </code></pre>
  
  <p>Here "list" refers to the <code>ArrayList</code>. </p>