I have the next method :
public void saveOnSDCard() {
File path = new File("storage/sdcard1");
File dir = new File(path + "");
if (!dir.exists()) {
dir.mkdirs();
}
File file = new File(dir, "test.png");
OutputStream os;
try {
os = new FileOutputStream(file);
image.compress(Bitmap.CompressFormat.PNG, 100, os);
os.flush();
os.close();
} catch (IOException ioe) {
showToast("Ошибка " + ioe.toString());
}
}
but when i try to call it, it gives me a java.io.fileNotFoundException(Permission denied). I have the next permission in my Manifest file:
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
So can someone tell me what's wrong ?
P.S image - Bitmap object, i declared it in another method.