0

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

user1400538
  • 855
  • 5
  • 24
  • 42
  • You can use `onResume()` to update UI of `SummerCostScreen` – Pragnani May 15 '13 at 07:04
  • Whatever I had in onactivityresult, when I paste it it in onResume, it does not update the UI. So, it is not working the way you suggested. – user1400538 May 15 '13 at 07:29
  • Place a debugger and check, is it entering to the `onResume` or not. – Pragnani May 15 '13 at 07:33
  • sorry, my mistake. It worked. One more question, is this the efficient method, since, I have to maintain a static bolean variable in called activity and track and update its status in caller activity? – user1400538 May 15 '13 at 07:35
  • Using intent extra to send its status and update it based on that..ok I'll post the same as answer – Pragnani May 15 '13 at 07:38
  • when coming back from second activity, how does intent extra work? can you please post that as well? – user1400538 May 15 '13 at 07:44
  • Have a look at [this post](http://stackoverflow.com/a/6679665/593709) may be of some help. – Adil Soomro May 15 '13 at 07:44
  • @user1400538 StartActivityForResult and then setResult in the second Activity and then finish it. And in onResume() get their values – Pragnani May 15 '13 at 07:48

1 Answers1

1

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

Pragnani
  • 20,075
  • 6
  • 49
  • 74