I've found that for the writing on '/data/data/myPackage/files/',
permissions need to be set.
There was MODE_WORLD_WRITEABLE,
that was the one with interest for this case,
but even with this permission set, I still got error.
I thought: "maybe what I need is an EXECUTE permission...".
There is no such permission in the API
but even though I tried to put a 3 in the mode parameter
(MODE_WORLD_WRITEABLE is = 2),
and...it worked!
But when I write to the sd card with that permission set,
I get an error as well,
so I write differently to the two folders.
int permission = 3;
if (whereToWrite == WRITE_TO_DATA_FOLDER) {
FileOutputStream fos = openFileOutput(file.getName(), permission);
buffOutStream = new BufferedOutputStream(fos);
} else if (whereToWrite == WRITE_TO_SD_CARD){
buffOutStream = new BufferedOutputStream(new FileOutputStream(file));
}
And by the way,
MODE_WORLD_WRITEABLE is wrong,
MODE_WORLD_WRITABLE is right.