views:

51

answers:

1

I'd like to launch a video capture Intent that calls me back with some kind of result. So far it correctly launches the G1's default Camcorder app, but when I finish recording the video in Camcorder, it just sits there (still in the Camcorder app) instead of calling my onActivityResult() method.

Is this just a shortcoming of Camcorder, or is there a special flag or extra I can set to tell it to return control when it's done recording? Ideally it would pass me back a handle to the video - a URI, an InputStream, a file path.

The code:

protected void launchRecordVideoActivity() {    
Intent intent = new Intent (android.provider.MediaStore.ACTION_VIDEO_CAPTURE);
startActivityForResult (intent, RequestCodes.RECORD_VIDEO);
}

RequestCodes is my own interface containing int constants.

public void onActivityResult (int requestCode, int resultCode, Intent intent) {
    ...
}

The contents of onActivityResult don't matter because my app is never called back at all. onActivityResult is not being called.

Any suggestions? I can also bake the video recording directly into the app, but I'd prefer not to.

A: 

You can't (generally) call startActivityForResult on an intent that starts an application outside of your application

Falmarri
Ah, okay, thank you. Is there another way to do it? i.e. launch an Intent that opens another application, with the request that it pass information back? My hope was that Android lets applications make requests of each other. For example, I think you can request a bitmap from the camera application, so I assumed you could request something similar (a video stream, file path, something like that) from it as well.
Jake
Actually, from all the reading I'm doing, Android definitely lets you launch Intents with the intention of getting information back, for example picking a Contact or an attachment for an email. So perhaps my question was too specific - if startActivityforResult() is not the correct way to do this, what is?
Jake
Yeah, it's possible, but that's why I said generally. Unless the activity is designed to return information, it won't work. And even still I'm not 100% sure how startActivityForResult works with external activities, but I've seen lots of problems here of people doing that.
Falmarri