i am using following code to start my activity
public void onClick(View v) {
Intent myIntent = new Intent(v.getContext(), AddReceipt.class);
startActivityForResult(myIntent, RECEIPT_ADDED);
}
Now i want to get arrays from addreceipt class or data from my child activity
public synchronized void onActivityResult(final int requestCode, int resultCode, final Intent data) {
if (resultCode == Activity.RESULT_OK)
{
if (requestCode == RECEIPT_ADDED)
{
String abc = "abs";
}
}
}
when calling this function, it returns data as null and result code as 0. How can i get my data from my child activity.
BesT Regards
To pass data from child activity to parent activity use the following code:
if value is an list of object use Serializable .
Now if you press back button ,
onActivityResultmethod of parent class will be called and you will getRESULT_CANCEL.