Android Getfiledir Vs Getdir
Solution 1:
According to documentation here and here
public File getFilesDir ()
Returns absolute path of directory on the filesystem where files created with
openFileOutput(String, int)
are stored.The returned path may change over time if the calling app is moved to an adopted storage device, so only relative paths should be persisted. No additional permissions are required for the calling app to read or write files under the returned path.
Where as
public File getDir(String name, int mode)
It takes name of the directory to retrieve. This is a directory that is created as part of your application data and operating mode(of type int). Use 0 or MODE_PRIVATE for the default operation, MODE_WORLD_READABLE and MODE_WORLD_WRITEABLE to control permissions.
Retrieve, creating if needed, a new directory in which the application can place its own custom data files.
You can use the returned File object to create and access files in this directory. Note that files created through a File object will only be accessible by your own application; you can only set the mode of the entire directory, not of individual files.
Post a Comment for "Android Getfiledir Vs Getdir"