如何清除所有正在运行的android应用程序的缓存?
在我的应用程序中,我尝试使用以下代码删除其他应用程序的缓存。但它只是删除我的应用程序缓存,而不是其他应用程序 代码如下:如何清除所有正在运行的android应用程序的缓存?,android,caching,Android,Caching,在我的应用程序中,我尝试使用以下代码删除其他应用程序的缓存。但它只是删除我的应用程序缓存,而不是其他应用程序 代码如下: public void clearApplicationData() { File cache = getCacheDir(); File appDir = new File(cache.getParent()); if (appDir.exists()) { String[] children = appDir.list(); for (Stri
public void clearApplicationData()
{
File cache = getCacheDir();
File appDir = new File(cache.getParent());
if (appDir.exists()) {
String[] children = appDir.list();
for (String s : children) {
if (!s.equals("lib")) {
deleteDir(new File(appDir, s));
Log.i("TAG", "**************** File /data/data/APP_PACKAGE/" + s + " DELETED *******************");
}
}
}
}
public static boolean deleteDir(File dir)
{
if (dir != null && dir.isDirectory()) {
String[] children = dir.list();
for (int i = 0; i < children.length; i++) {
boolean success = deleteDir(new File(dir, children[i]));
if (!success) {
return false;
}
}
}
return dir.delete();
}
public void clearApplicationData()
{
文件缓存=getCacheDir();
File appDir=新文件(cache.getParent());
if(appDir.exists()){
String[]children=appDir.list();
for(字符串s:子项){
如果(!s.equals(“lib”)){
deleteDir(新文件(appDir,s));
Log.i(“标记”,“文件/数据/数据/应用程序包/”+s+“已删除”*****************************”);
}
}
}
}
公共静态布尔deleteDir(文件目录)
{
if(dir!=null&&dir.isDirectory()){
String[]children=dir.list();
for(int i=0;i
你真的想要一些清除你的应用缓存的应用吗?@Sairam你找到了关于这个的任何东西吗?如果是,你能分享吗?