如何在关闭相机意图之前拍摄多张照片? [英] How to take multiple photos before dismissing camera intent?

查看:24
本文介绍了如何在关闭相机意图之前拍摄多张照片?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用通过 Intent (MediaStore.ACTION_IMAGE_CAPTURE) 启动的默认设备相机应用程序拍摄多张照片.使用我正在测试的设备,相机启动,拍照,要求确认,然后返回我处理结果的活动.

I am trying to take multiple photos using the default device camera application launched through an intent (MediaStore.ACTION_IMAGE_CAPTURE). With the devices I am testing with, the camera launches, takes a picture, asks for confirmation, then returns to my activity where I process the result.

我考虑过使用广播接收器回调或内容观察器;但是,我找不到启动相机并使其保持活动状态直到用户完成的方法.如果可能,我希望避免开发自定义相机应用程序.

I've considered using broadcast receiver callbacks or a content observer; however, I cannot find a way to launch the camera and keep it active until the user is finished. If possible, I wish to avoid developing a custom camera application.

之所以必须这样做是因为用户通常需要连续拍摄多张照片,并且在某些设备上相机启动时间超过5秒,使用该软件的用户连续拍摄10-30张照片;不仅如此,他们还需要控制各种相机参数.

The reason I must do this is because users commonly need to take multiple photos in succession, and on some devices the camera start-up time is upwards of 5 seconds, and the users using the software take 10 - 30 photos consecutively; not only that, but they need control over various camera parameters.

有没有办法启动相机意图并仅在用户退出相机应用程序后返回我的活动?

Is there a way to launch the camera intent and only return to my activity once the user exits the camera application?

推荐答案

我通过 SDK 文档发现,设备摄像头有一个替代意图操作,它以静止图像模式启动摄像头,并且在用户完成之前不会退出与活动:

I discovered through the SDK documentation that there's an alternative intent action for the device camera that launches the camera in still image mode and does not exit until the user is finished with the activity:

Intent intent = new Intent(
    MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA);
this.startActivity(intent);

加上一个 ContentObserver 这正是我需要完成的.

Coupled with a ContentObserver this was exactly what I needed to accomplish.

这篇关于如何在关闭相机意图之前拍摄多张照片?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆