I need to make a directory if not exist. I've wrote codes below
File backupDir = new File("//test");
// if (!backupDir.exists())
backupDir.mkdirs();
I've previously used it without any problem, But now not works and I have no errors! What is the problem? Have you any idea to solve this?
Thanks in advance
Have you any idea to solve this?
Use a valid path that you can write to. Not only is //test
a strange way to encode a path, you cannot write to it on any Android device from Java code this way. Use appropriate methods, like getFilesDir()
or getExternalFilesDir()
, to find places that you can write to.