Android垃圾清理功能的初步
16lz
2021-01-23
//清理webkit的缓存File file = CacheManager.getCacheFileBaseDir(); if (file != null && file.exists() && file.isDirectory()) { for (File item : file.listFiles()) { item.delete(); } file.delete(); } //清理缓存,此方法只会清理cache文件夹中的File File[] files = getCacheDir().listFiles(); for (File f : files) f.delete();
参考1:
清理软件缓存——eoe论坛
http://www.eoeandroid.com/forum.php?mod=viewthread&tid=84014&reltid=38039&pre_pos=3&ext=
这里分为一种需要root权限的,另外一种是不需要root的
参考2:
清理软件缓存——eoe论坛
http://www.eoeandroid.com/forum.php?mod=viewthread&tid=164193&reltid=38039&pre_pos=1&ext=
public void clear(){
File[] files = getCacheDir().listFiles();
for (File f : files)
f.delete();
}
这里会为APP生成一个对应的cache文件夹
参考3:
http://www.eoeandroid.com/thread-38039-1-1.html
参考4:
清理webView,即webkit的cache
http://jbg168.blog.163.com/blog/static/99683620115242389635/
更多相关文章
- android自己开发的系统软件报错
- Exoplayer2实现边播放边缓存
- Android 软件更新安装时报错:FileUriExposedException: file:///s
- Android中集成第三方软件包(.jar, .so)
- Android仿人人客户端(v5.7.1)——对从服务器端(网络)获取的图片进行
- 【小米招聘]】Android系统软件测试工程师
- Android性能:经典ListView适配器convertView缓存及复用机制
- MVP框架 – Ted Mosby的软件架构