in some part of my application there is a structure of activities like this:
<
Yup, great formatting. And you can -- and probably should -- definitely call startActivityForResult()
from each of Activity A, B, and C (and don't finish()
right away). In B and C you can check for a successful result and finish()
, passing the result on back to A.
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if((resultCode == RESULT_OK) && (requestCode == MY_RESULT_CODE)) {
setResult(RESULT_OK, data);
finish();
}
}
If you want B and C to disappear regardless, do the following instead:
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
setResult(resultCode, data);
finish();
}