Android相机没有保存在特定文件夹中[MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA] [英] Android Camera no save in specific folder [MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA]

查看:790
本文介绍了Android相机没有保存在特定文件夹中[MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在Intent中使用MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA时,我遇到了问题。相机正确启动但它不会将文件保存在我的特定文件夹/ photo中。但是当我使用MediaStore.ACTION_IMAGE_CAPTURE它工作正常,但我不能使用它,因为它每次只拍一张照片。
我需要相机启动,用户需要拍很多照片。关闭相机后,所有照片都保存在我的特定文件夹中。

I'm a problem when I using the MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA in the Intent. The camera starts correctly but it doesn't save the files in my specific folder "/photo". But when I use the MediaStore.ACTION_IMAGE_CAPTURE it works fine, but I can't use this because it take only one photo each time. I need the camera starts and the user takes many photos. After he closes the camera and all photos are saved in my specific folder.

感谢您的帮助。

问候,

Marcelo

源代码:

public void startCamera() {     
    Intent takePictureIntent = new Intent(MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA);
    File file = null;
    try {
        file = createImageFile();
        takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(file));
    } catch (IOException e) {
        file = null;
        Log.e(this.getClass().getName(), e.getMessage(), e);            
    }
    activity.startActivity(takePictureIntent);
}


private File createImageFile() throws IOException {
    String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
    String imageFileName = JPEG_FILE_PREFIX + timeStamp + JPEG_FILE_SUFFIX;
    return new File(Environment.getExternalStorageDirectory().getAbsolutePath() + "/photo/", imageFileName);
}


推荐答案

MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA 此意图不支持活动结果或特定意图文件输出。此意图旨在简单地打开相机。您寻求的功能在Android中不存在。

MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA This intent does not support activity results or specific intent file outputs. This intent is designed to simply open the camera. The functionality you seek does not exist natively in Android.

这篇关于Android相机没有保存在特定文件夹中[MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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