I have three activities A, B and C.
A starts B with startActivityForResult(getIntent(), ACTIVITY_B);
and B starts C with startActivityForResult(getIntent(), ACTIVITY_C);
. ACTIVITY_B
and ACTIVITY_C
are constants with same value across activities.
When C returns with RESULT_OK, then B is restarted with the code:
if (resultCode == Activity.RESULT_OK){
finish();
startActivityForResult(getIntent(), ACTIVITY_B);
}
This works fine.
When B has to return (on clicking a menu item), it sets the activity result.
public boolean onMenuItemSelected(int featureId, MenuItem item) {
switch(item.getItemId()) {
case MENU_CONFIRM:
System.out.println("Setting Result to RESULT_OK");
setResult(Activity.RESULT_OK);
finish();
return true;
}
return super.onMenuItemSelected(featureId, item);
}
However I can see that the setResult(Activity.RESULT_OK);
is ignored because it is always received as RESULT_CANCEL
in the Activity A (onActivityResult
). I'm using 2.3.
Any clues?