spogebob92
spogebob92

Reputation: 1484

Figuring out where Android stores files

I am writing to a file in my application. I want to find the file to check that the file has been written correctly (and so I can access the file via a web view). Here is the code I am using to write the file:

try {
    FileOutputStream fos = openFileOutput("rules.txt", Context.MODE_PRIVATE);
    fos.write(content.getBytes());
    fos.close();
} 
catch (Exception e) {
    e.printStackTrace();
}

and then I use this to get the directory of the file:

getFilesDir()

However the string it provides is not available as a directory on the my device (hidden files are shown).

Any help would be appreciated!

Upvotes: 0

Views: 70

Answers (1)

Raghav Sood
Raghav Sood

Reputation: 82583

Android writes your internal files to /data/data/<your package name>/files/<filename>. You cannot access this via a file browser or something unless you are rooted.

Upvotes: 2

Related Questions