I am trying to write to a specific path in internal storage in my android app :/data/somefolder but I get the error java.io.filenotfoundexception : Permission denied
String testString="Hello World!";
File newFile=new File("/data/somefolder/testFile.txt");
try{
OutputStream myOut=new BufferedOutputStream(new FileOutputStream(newFile,true));
myOut.write(testString.getBytes());
myOut.flush();
myOut.close();
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
My question is : Is it even possible to write into this folder in android internal storage or does android restrict file creation only to the specific package like /data/data/package/files ?
I tried using FileOutputStream and the file got created successfully in /data/data/package/files.