In my android app, I have a main activity which creates two other sub activites through intent. Now, both the sub activity return result to the main activity. In my main act
That's what the requestCode is for. So you'd have a setup like this
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data)
{
super.onActivityResult(requestCode, resultCode, data);
switch(requestCode)
case ACTIVITY1:
if(resultCode == RESULT_OK)
Toast.makeText(getApplicationContext(), "Activity 1 returned OK", Toast.LENGTH_LONG).show();
break;
case ACTIVITY2:
if(resultCode == RESULT_OK)
Toast.makeText(getApplicationContext(), "Activity 2 returned OK", Toast.LENGTH_LONG).show();
break;
}
Where ACTIVITY1 and ACTIVITY2 are constants in your Activity. You'd call them like so:
startActivityForResult(activity1Intent, ACTIVITY1);
and
startActivityForResult(activity2Intent, ACTIVITY2);