Android Camera no save in specific folder [MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA]

不问归期 提交于 2020-01-24 05:38:31

问题


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.

Thanks for your help.

Regards,

Marcelo

Source code:

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);
}

回答1:


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.



来源:https://stackoverflow.com/questions/11637412/android-camera-no-save-in-specific-folder-mediastore-intent-action-still-image

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!