title: Update an object passed through Parcelable intent
body: <p>I'm new to Android and i'm still learning. I currently have a ListView which allows you to click on an item. Clicking on an item will open a new intent displaying extra information about the item.</p>
  
  <p>The thing i'm tripping up on is figuring out how to get the updated values back into my custom object and update the values in array at the correct index.</p>
  
  <p>For example:
  I'll add an item and set it's quantity to 2. This will appear in my ListView. Great. I decide i need 3 instead of 2, so i click the item to open the new activity, see 2 sitting in quantity, update it to 3 and hit save. On the save click i want to go back to my listview and have the updated quantity value displaying there and also updated in the array at the index.</p>
  
  <p>Code for segments:</p>
  
  <p>Onclick method for the listview in ItemList class</p>
  
  <pre><code>listview.setOnItemClickListener(new AdapterView.OnItemClickListener() {
  
          //@Override
          public void onItemClick(AdapterView&lt;?&gt; arg0, View arg1,
                                  int arg2, long arg3) {
  
              bean = (CustomObject) listview.getItemAtPosition(arg2);
  
              Intent in1 = new Intent(Itemlist.this, SingleItem.class);
              in1.putExtra("ActivityObject", bean);
              startActivity(in1);
          }
      });
  </code></pre>
  
  <p>Adding an item the array in my ItemList class. this contain the listview.</p>
  
  <pre><code>else {
                  objects.add(new CustomObject(roomname.getText().toString() + " - " + resultSet.get(namecount), resultSet.get(partno), itemq, "$" + resultSet.get(rrpcol), resultSet.get(glcode), resultSet.get(desc)));
                  adapter.notifyDataSetChanged();
  </code></pre>
  
  <p>SingleItem class</p>
  
  <pre><code>protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_singleitem);
  
      siname = (TextView) findViewById(R.id.siname);
      sipartno = (TextView) findViewById(R.id.sipartno);
      siquantity = (EditText) findViewById(R.id.siq);
      sirrp = (EditText) findViewById(R.id.sirrp);
      siglcode = (TextView) findViewById(R.id.siglcode);
      sidesc = (EditText) findViewById(R.id.sidesc);
      update = (Button) findViewById(R.id.siupdate);
  
      Bundle b = getIntent().getExtras();
      CustomObject itemInfo = b.getParcelable("ActivityObject");
  
      siname.setText(itemInfo.getItemName());
      sipartno.setText(itemInfo.getItemPartNo());
      siquantity.setText(itemInfo.getItemQuantity());
      sirrp.setText(itemInfo.getItemPrice());
      siglcode.setText(itemInfo.getItemGLCode());
      sidesc.setText(itemInfo.getItemDesc());
  }
  </code></pre>
  
  <p>Custom Object class</p>
  
  <pre><code>public class CustomObject implements Parcelable {
  
  private String itemName;
  private String itemPartNo;
  private String itemQuantity;
  private String itemPrice;
  private String itemGLCode;
  private String itemDesc;
  
  public CustomObject(Parcel source){
          /*
           * Reconstruct from the Parcel
           */
      //Log.v(TAG, "ParcelData(Parcel source): time to put back parcel data");
      //id = source.readInt();
      itemName = source.readString();
      itemPartNo = source.readString();
      itemQuantity = source.readString();
      itemPrice = source.readString();
      itemGLCode = source.readString();
      itemDesc = source.readString();
  
  }
  
  public CustomObject(String prop1, String prop2, String prop3, String prop4, String prop5, String prop6) {
      this.itemName = prop1;
      this.itemPartNo = prop2;
      this.itemQuantity = prop3;
      this.itemPrice = prop4;
      this.itemGLCode = prop5;
      this.itemDesc = prop6;
  }
  
  public String getItemName() {
      return itemName;
  }
  
  public String getItemPartNo() { return itemPartNo; }
  
  public String getItemQuantity() {
      return itemQuantity;
  }
  
  public String getItemPrice() {
      return itemPrice;
  }
  
  public String getItemGLCode() {return itemGLCode;}
  
  public String getItemDesc() {return itemDesc;}
  
  @Override
  public int describeContents() {
      return 0;
  }
  
  @Override
  public void writeToParcel(Parcel dest, int flags) {
      dest.writeString(itemName);
      dest.writeString(itemPartNo);
      dest.writeString(itemQuantity);
      dest.writeString(itemPrice);
      dest.writeString(itemGLCode);
      dest.writeString(itemDesc);
  }
  
  public static final Parcelable.Creator CREATOR = new Parcelable.Creator() {
      public CustomObject createFromParcel(Parcel in) {
          return new CustomObject(in);
      }
  
      public CustomObject[] newArray(int size) {
          return new CustomObject[size];
      }
  };
  </code></pre>
  
  <p>}</p>
  
  <p>I want to be able to change the quantity in the SingleItem class, click the Update button, and then have it load up the itemlist class with the updated values in the item list.</p>