startActivityForResult from ActivityGroup

2019-08-26 13:06发布

问题:

I am using ActivityGroup. I use the following code from ActivityGroup in order to replace view and launch a new activity.

Intent i = new Intent(SummaryCostScreen.this,PermissionsScreen.class);
replaceContentView("activity1",i);

public void replaceContentView(String id, Intent newIntent) {
    View view = getLocalActivityManager().startActivity(id, 
    newIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)).getDecorView();
}

The problem with the above code is that, I need to have startActivityForResult in place of startActivity, since I need to update the UI of launcher activity when coming back from the launched activity.

getLocalActivityManager() does not have startActivityForResult. How should I address this situation, such that, I am able to update UI from onActivityResult?

Any help is much appreciated.

PS: I cannot change the replaceContentView approach for launching new screen, since that has been used at numerous other places and this is the only scenario in which I need to call startActivityForResult

回答1:

Converting comments as answer, Try using onResume() to update UI of SummerCostScreen