Where is the file saved when using openFileOutput?

Is it possible to find out where the file created

ApplicationContext.openFileOutput(filename, Context.MODE_WORLD_READABLE); 

save? I don't need any java code to print the path, which should be getFileStreamPath(filename) , I just need the default storage location for such files. I did not find useful things in javadoc android

+7
source share
4 answers

see this page: http://developer.android.com/reference/android/os/Environment.html You can get some sort of directory path.

I think if you try to directly use ApplicationContext.openFileOutput(filename, Context.MODE_WORLD_READABLE); , the file will be created in the root directory of the phone, but I'm not sure, or in / data.

-one
source

If you have a built-in phone, see / data / data. There will be a folder with your package name with all of your files that you saved.

But you will need the root root explorer to view these files.

+3
source

If you call getFilesDir() and repeat it, you can compare the file name string you used with openFileOutput to create the exact path for this file.

+2
source

It is better to follow Guillaume and check the environment for which the current location is located. Because openFileOutput is part of the Context class, it changes depending on the underlying context used. For example, during testing, you can get a RenamingDelegatingContext , which overrides openFileOutput, renaming files and can place them anywhere.

+1
source

All Articles