I’m creating a file in data/data/myPackage/files/ :
file = new File( getFilesDir() + "/file.txt");
I’m absolutely sure that the file is created.
Right after its creation I call:
file.canWrite();
and the result is true.
When I try to use that file
I get: “Permission Denied”.
In Eclipse, in DDMS, this file permissions are like:
-rw-------
Can anyone help here?
Thanks
Easiest way to open the file (and create it at the same time) would be to use the
openFileOutput("file.txt", MODE_PRIVATE)method.This ensures that the file is only readable by your application (the same as you’ve have at the moment), plus it returns you a
FileOutputStreamso you can start writing to it.