/**
* 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.
*
* @param name Name of the directory to retrieve. This is a directory
* that is created as part of your application data.
* @param mode Operating mode. Use 0 or {@link #MODE_PRIVATE} for the
* default operation, {@link #MODE_WORLD_READABLE} and
* {@link #MODE_WORLD_WRITEABLE} to control permissions.
*
* @return A {@link File} object for the requested directory. The directory
* will have been created if it does not already exist.
*
* @see #openFileOutput(String, int)
*/
public abstract File getDir(String name, int mode);
通過註釋我們可以看到這個方法是會在data/data/your pkg
創建一個目錄的,只有你自己的應用有權限訪問。
因而可以用這個方法快速創建一個data裏面的目錄。