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
It's possible to return any kind of data from a subactivity in the result intent parameter:
Sub-activity:
Intent intent = new Intent ();
intent.putExtra ("string_1", "hello");
intent.putExtra ("string_2", "world");
intent.putExtra ("int_1", 1000);
intent.putExtra ("long_1", 2000l);
activity.setResult (Activity.RESULT_OK, intent);
_
Parent activity:
@Override
protected void onActivityResult (int requestCode, int resultCode, Intent intent)
{
if (resultCode == Activity.RESULT_OK)
{
String string_1 = intent.getStringExtra ("string_1", "");
String string_2 = intent.getStringExtra ("string_2", "");
int int_1 = intent.getIntExtra ("int_1", 0);
long long_1 = intent.getLongExtra ("long_1", 0);
}
}