i have a very small problem. I am writing a file to sdcard. I’l show you two code, one code works and other doesn’t. It looks like this:
First one,
new FileOutputStream("/sdcard/HelloWorld.txt")
This works fine and creates a HelloWorld.txt file in sdcard.
Now second one,
new FileOutputStream(android.os.Environment.getExternalStorageDirectory()+java.io.File.separator + "filetest" + java.io.File.separator + "HelloWorld.txt")
This throws error “/mnt/sdcard/filetest/HelloWorld.txt (No such file or directory)“.
I want to know why because i have mnt/sdcard path on my device, is it that it cannot find filetest folder if yes then isn’t it supposed to create filetest folder if its not created before.
Thanks.
First Make a directory of
filetestif its not available,Then execute your code…
OR