I'm using a simple camera intent following the basic tutorial from Android. In this section it talks about saving the image file to disk. However, I haven't yet configured any of these steps, but after capturing the image and returning to my activity, it's still automatically saving my image to disk in /storage/emaulated/0/DCIM/Camera. This doesn't seem to be what's implied by the tutorial - I don't even have the WRITE_EXTERNAL_STORAGE permission in my manifest so I'm not sure why it's even allowed to write to disk. I don't want the image to automatically save to this directory, but rather to a directory of my choosing. I know how to save the image to a custom directory, but how can I prevent the default behavior of saving the image to the directory above?
When you try to take a phto, actually you are start calling Camera
App installed in your device. You didn't set WRITE_EXTERNAL_STORAGE
, Oh yes, but the App of Camera
is set. And when you try to take a picture but want to store the photo into your file, you could try this:
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra("return-data", false);
intent.putExtra(MediaStore.EXTRA_OUTPUT,
Uri.fromFile(AVATAR_FILE_TMP));
intent.putExtra("outputFormat",
Bitmap.CompressFormat.JPEG.toString());
intent.putExtra("noFaceDetection", true);
startActivityForResult(intent, TAKING_PICTURE_INDEX);
And filePath
is the path of the image file you take by Camera
. Taking a photo uses Camera
App.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With