i am trying to pass an arraylist back to my parent activity
Here is the simple code.
private ArrayList<Receipt> receipts = new ArrayList<Receipt>();
 Intent data = new Intent();
 data. // what to do here?
setResult(RESULT_OK, data); 
//************************************
This is basic receipt Class
public class Receipt {
    public String referenceNo;
    public byte[]   image;
    public String comments;
    public Date   createdOn;
    public Date   updatedOn;
Tell me how can i add it in my intent and how can i retrieve it back in parent activity from
onActivityResult(final int requestCode, int resultCode, final Intent data)
                You can use data.putExtra()/bundle.putSerializable() to put custom objects in a Bundle/Intent, however, you have to make your class Receipt implement Serializable (just put implements Serializable after the class name, that's all there is to it with such a simple class.
Then to read it back you use getSerializable().  
Note: I don't think that the Date-class is serializable, you might want to replace those with a long representing time in milliseconds instead ( you can use Date.getTime() for that).
Example:
public class Receipt implements Serializable{
    public String referenceNo;
    public byte[]   image;
    public String comments;
    public long   createdOn;
    public long   updatedOn;
    //...
}
//Put the list in the intent
List<Receipt> list = ...
Intent data = new Intent();
data.putExtra("tag", list);
//Read the list from the intent:
list = (List<Receipt>) data.getSerializableExtra("tag");
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With