开发者

startActivityForResult(android.provider.MediaStore.ACTION_VIDEO_CAPTURE) never returns result

开发者 https://www.devze.com 2023-01-13 03:49 出处:网络
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,

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 开发者_如何学Pythonto 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.


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


Same code works fine on SE x10 (updated to sdk 2.1). Activity starts, user starts recording video and when he press stop - video onActivityResult() is run in calling class. Probably it was fixed in later SDK releases.

0

精彩评论

暂无评论...
验证码 换一张
取 消