如何在Android中使用相机拍摄多个图像 [英] How to take multiple images using camera in android

查看:93
本文介绍了如何在Android中使用相机拍摄多个图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一台可以同时拍摄多张照片然后选择一张的照相机。其他可能会或可能不会存储在设备上。我已经尝试了。我可以拍摄多张图像,但是如何选择一张图像并在我的应用程序中使用它呢?我阅读了与camera2有关的文档,但没有任何实际示例就很难理解。我还尝试了这些,但是孤立的代码片段将无济于事。
与使用连拍相机有关的任何示例都将有所帮助。

I need a camera that allows me take multiple pictures at once and then select one. Others may or may not be stored on the device. I've tried this. I can take multiple images but how to select one and use it in my app? I read the documentation related to camera2 but its hard to understand without any practical example.I also tried these, but an isolated snippet won't help. Any example related to the use of burst camera would help.

我不希望有完整的代码,但是有关如何进行操作的任何指示?在相机屏幕本身上单击时,是否可以将图片缩略图显示为。我需要选择图像的位图。

I do not expect a full code, but any directions on how to proceed? Is it possible to display the picture thumbnails as an when they are clicked on the camera screen itself. I'll need to have the bitmap of the image selected.

如果不清楚,我可以改写问题的任何部分。

I can rephrase any part of the question if not clear.

推荐答案

尝试一下

您可以拨打第二个电话您从第一个 startActivityForResult()获取的 onActivityResult()中的 startActivityForResult() code>。

you can Call your second startActivityForResult() from the onActivityResult() you get from your first startActivityForResult().

通过此代码,您可以获得10张图片

public int PIC_CODE=0;

protected void onActivityResult(int requestCode, int resultCode, Intent data) {  
    if (requestCode == CAMERA_REQUEST && resultCode == Activity.RESULT_OK) {  

        // get new image here like this
       if(PIC_CODE<10){
            // add new requset of picture like this
            Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); 
            startActivityForResult(cameraIntent, CAMERA_REQUEST); 
            PIC_CODE++;
    }  
} 

这篇关于如何在Android中使用相机拍摄多个图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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