saving pictures taken by camera in android app

ぐ巨炮叔叔 提交于 2019-11-29 12:52:28
Raghunandan
File imagesFolder = new File(Environment.getExternalStorageDirectory(), "MyImages");
imagesFolder.mkdirs();   
File image = new File(imagesFolder, "image.jpg");
Uri uriSavedImage = Uri.fromFile(image);
imageIntent.putExtra(MediaStore.EXTRA_OUTPUT, uriSavedImage);

Have a look at this link.How to save images from Camera in Android to specific folder?

In your onClick where you call the Intent you should specify the output file by utilizing your existing getOutputMediaFileUri like this:

    i = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
    i.putExtra(MediaStore.EXTRA_OUTPUT, getOutputMediaFileUri());
    startActivityForResult(i, cameraData);

So now YOU are telling the camera where to save the file rather than asking where it was saved. This is how I got my camera app to work so that I could access the picture after it was snapped.

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