Я пытаюсь записать изображение в файл в соответствии с инструкциями here. Тем не менее, я получаю это исключение: libcore.io.ErrnoException: open failed: EACCES (Permission denied)
Вот мой код, где это исключение, по-видимому всплывает:Android - libcore.io.ErrnoException: open failed: EACCES (Permission denied)
private File createImageFile(int side) throws IOException {
String timestamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
String imageFileName = "";
if (side==1) {
imageFileName = "Front_"+timestamp;
} else {
imageFileName = "Side_"+timestamp;
}
File storageDir = Environment.getExternalStoragePublicDirectory(
Environment.DIRECTORY_PICTURES);
File image = File.createTempFile(
imageFileName,
".jpg",
storageDir
);
// Save the file
mCurrentPhotoPath = "file:"+image.getAbsolutePath();
return image;
}
Спасибо за помощь заранее.