I wonder if data can be processed, for example. activity 2 and activity 3 in activity 1, which have one onActivityResult() , or do I need to have one method for each activity that returns data?
Action 1 is the main activity for the application.
Action 1:
// Handle return value from activity protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode == Activity.RESULT_OK) { String imageId = data.getExtras().getString("imageId"); // Do something if data return from activity 2 ?? // Do something if data return from activity 3 ?? } }
Action 2
Intent intent = new Intent(); intent.putExtra("imageId", imagePath); setResult(RESULT_OK, intent); finish();
Action 3
Intent intent = new Intent(); intent.putExtra("contactId", data); setResult(RESULT_OK, intent); finish();
source share