This is my directory structure on my Android sdcard
sdcard/alQuranData/Reader1/Surah
Here is my code to make Directories
File SDCardRoot = new File(Environment.getExternalStorageDirectory().toString() + "alQuranData/Reader1/Surah");
Toast.makeText(getApplicationContext(), SDCardRoot.toString(), Toast.LENGTH_LONG).show();
if (!SDCardRoot.exists()) {
Log.d("DIRECTORY CHECK", "Directory doesnt exist creating directory");
SDCardRoot.mkdir();
}
Now alQuranData is already created in my sdcard root. If i only create Reader1 directory than it works fine, but when is add Reader1/Surah than it did not create.
I also tried mkdirs() but it doesn’t work.
Are you getting any error or exception. Please try to check the return value of
mkdirs()method call. ALso try the following code:Please also check that you have added following permission in manifest file:
I just tested the following code and it is working on my end:
I have added alQaranData folder manually as mentioned in your post and added the permission and it start working at my end. Please check this code.