关于data/data/包名 目录
1.关于此目录
此目录是app的私有目录,本身可以访问,外部程序没有访问权限,一些不想让用户看到的文件可以往这里边扔;此目录在程序卸载后将被删除;对应设置中的“数据”一项,如果清空数据,这个目录将会被清空。app自身对此目录的读写不需要额外的权限,because this path is internal storage;
2.目录的操作
Context 提供了一些API方便我们操作此目录
1. getFilesDir();
此函数返回的路径:/data/data/xxx包名/files
Returns the absolute path to the directory on the filesystem where files created with openFileOutput(String, int) are stored.
在这个目录下创建文件有函数:
1.1.public FileOutputStream openFileOutput(String name, int mode)
Open a private file associated with this Context’s application package for writing. Creates the file if it doesn’t already exist.
值得一提的是其中第二个参数 mode,自从api17之后,MODE_WORLD_WRITEABLE
和MODE_WORLD_READ