I am trying to save photo and video like
Intent imageIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
String pathMedia = Environment.getExternalStorageDirectory().getAbsolutePath() + "/MyImages/image_001.png";
Uri uriSavedImage = Uri.fromFile(new File(pathMedia));
imageIntent.putExtra(MediaStore.EXTRA_OUTPUT, uriSavedImage);
but it doesn't work ( I pass through onResult and everything is Ok ) but there is no folder MyImages. How to force phone to save images to specific folder ( it needs to work on every model phone with Froyo or upper) ? I added to manifest WRITE_EXTERNAL STORAGE and CAMERA privileges.
It's probably because you never created the folder, try this:
File imagesFolder = new File(Environment.getExternalStorageDirectory(), "MyImages");
imagesFolder.mkdirs(); // <----
File image = new File(imagesFolder, "image_001.jpg");
Uri uriSavedImage = Uri.fromFile(image);
imageIntent.putExtra(MediaStore.EXTRA_OUTPUT, uriSavedImage);
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