startActivityForResult from ActivityGroup?
I've had a similar issue. I had an ActivityGroup managing sub-activities. One of the sub-activities called a similar external intent (external to my app). It never called the onActivityResult within the sub-activity that started it.
I finally figured out/remembered that the issue is because Android will only allow a nested layer of sub-activities...ie sub-activities can't nest sub-activitites. To solve this:
- call
getParent().startActivityForResult()
from your sub-activity - your parent (the activitygroup) will be able to handle the
onActivityResult
. So I created a subclass ofActivityGroup
and handled thisonActivityResult
. - You can re-route that result back to the sub-activity if you need to. Just get the current activity by
getLocalActivityManager().getCurrentActivity()
. My sub-activities inherit from a custom activity so I added ahandleActivityResult(requestCode, resultCode, data)
in that subclass for theActivityGroup
to call.
In Your Parent Activity
protected void onActivityResult(int requestCode, int resultCode, Intent intent){
if (requestCode == YOUR_REQUEST_CODE) {
CHILD_ACTIVITY_NAME activity = (CHILD_ACTIVITY_NAME)getLocalActivityManager().getCurrentActivity();
activity.onActivityResult(requestCode, resultCode, intent);}}
So your childern activity's onActivityResult will run.