使用API获取文件内部存储路径详解(getFilesDir()和getCacheDir())
来源:互联网 发布:杭州软件开发培训 编辑:程序博客网 时间:2024/05/18 14:23
安卓提供两个API,获取文件内部存储路径getFilesDir(),getCacheDir(),这两个api的区别
相同点:都可以在内部存储空间创建文件夹,返回的都是文件夹对象
getFilesDir() 其会创建data/data/packagename/files 文件夹
getCacheDir() 其会创建data/data/packagename/cache 文件夹 ,cache是缓存的意思,这些文件一旦设备内部存储空间不足时,这些保存在
cache下的文件会删除,不要指望系统为你删除,一般需要自己设定阈值,一旦系统满时,系统也会删掉cache!---- 一般聊天记录都会使用
getCacheDir()中。
1、以下两条语句是同一个意思
File file=new File(getFilesDir(),"info");//File file =new File("data/data/writeinrom.workharder.com.writeinrom/info.txt");
2、File file=new File(getCacheDir(),"info");
0 0
- 使用API获取文件内部存储路径详解(getFilesDir()和getCacheDir())
- Android获取应用程序路径getCacheDir()和getFilesDir()
- 使用API获取内部存储文件的路径;外部存储
- android--内部存储写文件和使用API获取内部存储路径,sharedperferance获取原有的账号密码--简单的登陆(记录原有的账号和密码)--I/0流介绍
- getCacheDir()和getFilesDir()
- getFilesDir和getCacheDir区别
- getCacheDir()、getFilesDir()、getExternalFilesDir()、getExternalCacheDir()路径
- 使用路径API获取获取内部存储目录的路径
- getCacheDir()和getFilesDir()方法区别.
- getCacheDir()和getFilesDir()方法区别
- getCacheDir()和getFilesDir()方法区别.
- getCacheDir()和getFilesDir()方法区别.
- getCacheDir()和getFilesDir()方法区别.
- getCacheDir()和getFilesDir()方法区别
- getCacheDir()和getFilesDir()方法区别.
- getCacheDir()和getFilesDir()方法区别
- getCacheDir()和getFilesDir()方法区别.
- getCacheDir()和getFilesDir()方法区别
- YTU 2442: C++习题 矩阵求和--重载运算符
- 《笨办法学Python》 第44课手记
- iOS第三方框架推荐
- 226. Invert Binary Tree
- 药品从药库到药房的流程注意事项----运维日志26
- 使用API获取文件内部存储路径详解(getFilesDir()和getCacheDir())
- 2015年Thinking of Working Attitude/关于工作态度的思考
- 深入了解 runloop
- POJ 1065
- 《数据结构》进行曲(三)线性表的链式表示和实现之二
- extern关键字
- android绘图
- C语言实现某年某月某日是某年的第几天
- 深浅复制