I can't seem to get ANY result when trying to start an activity from an activitygroup. I've put an onactivityresult in the activity and activitygroup? Specifically I'm trying to let the user choose a photo/video from the Intent.ACTION_GET_CONTENT, but I never get anything back? What am I doing wrong?
Here is how I call the code:
Intent pickMedia = new Intent(Intent.ACTION_GET_CONTENT);
pickMedia.setType("video/*");
startActivityForResult(pickMedia,12345);
Any ideas?
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:
getParent().startActivityForResult()
from your sub-activityonActivityResult
. So I created a subclass of ActivityGroup
and handled this onActivityResult
.getLocalActivityManager().getCurrentActivity()
. My sub-activities inherit from a custom activity so I added a handleActivityResult(requestCode, resultCode, data)
in that subclass for the ActivityGroup
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With