how to use startActivityForResult() with a singletask activity
In our requirement, we need to refresh A activity after B activity finish. but B activity is set as singletask. Is there any flag 开发者_如何转开发or another API can fulfill this requirement?
thank you.
AFAIK, the only way to achieve the thing you want - using broadcasting: when B has been finished - send broadcast and in A catch it.
btw, is it so necessary to use singletask?
If you want to set some result to activity A from Activity 2 then you have two options
1) If you have one activity already in activity stack
then you have two options
1=> Use startActivityFroResult()
and set result back to calling activity
2=> Make fields in activity A as public static
and assign values from activityB and onResume()
of ActivityA refresh view of ActivityA
2) If you have not ActivityA in activity stack
then just pass the necessary values with the intent and from ActivityA onCreate()
method fetch all values from intent and load view
精彩评论