I use the following code:
final File newFile = new File("/mnt/sdcard/test/");
newFile.mkdir(); // if I use mkdirs() result is the same
And it creates an empty file! Why?
I use the following code:
final File newFile = new File("/mnt/sdcard/test/");
newFile.mkdir(); // if I use mkdirs() result is the same
And it creates an empty file! Why?
Try to use
First of all you shouldn't use a file path with "/mnt/sdcard/test", this may cause some problems with some android phones. Use instead:
It creates an empty file since you added the dash.
Now that you have your path use the following code:
You wouldn't use mkdirs() unless you wanted each of those folders in the structure to be created. Try not adding the extra slash on the end of your string and see if that works.
For example
When I need to ensure that all dirs for a file exist, but I have only filepath - i do