关于android data/data/包名 目录

关于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_WRITEABLEMODE_WORLD_READ

  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值