I'm trying to generate a folder with my android application in my phone storage (not on the sdcard) but my mkdirs()
is not working.
I have set the android.permission.WRITE_EXTERNAL_STORAGE
in my manifest and use this basic code :
File mediaStorageDir = new File(Environment.getExternalStorageDirectory(), "/MyDirName");
if (!mediaStorageDir.exists()) {
if (!mediaStorageDir.mkdirs()) {
Log.d("App", "failed to create directory");
}
}
but it doesn't work ... The mkdirs
is always at false and the folder is not created.
I have tried everything and looked at all the topics about it but nothing is working and I don't know why.