What file system path is used by Android's Context.openFileOutput()?
Solution 1:
Re the openFileOutput() method on the Context class to open a file for writing, what internal storage file path does it write to?
It points to where getFilesDir()
on Context
returns. You can tell this because the documentation says:
Returns the absolute path to the directory on the filesystem where files created with openFileOutput(String, int) are stored.
Solution 2:
In DDMS, I found my file under:
data > data > your app id > files
Solution 3:
You can retrieve that file path by calling Context#getFileStreamPath(String)
:
Returns the absolute path on the filesystem where a file created with
openFileOutput(String, int)
is stored.
It returns a File
, so then call File#getAbsolutePath()
.
So summing up:
context.getFileStreamPath(name).getAbsolutePath()