I would like to pass arguments from an activity B to A where B has been launched by A. Is this possible to do so ? Thanks
Yes, if when you launch Activity
B from A, you start it using startActivityForResult
then you can set a result in Activity
B then read the value in A.
In A you would need to override onActivityResult
to get the result value.
In Activity
B:
// do stuff
setResult(RESULT_OK);
finish();
Then in A:
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
super.onActivityResult(requestCode, resultCode, intent);
//check result
}
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