我有一个代码来清除应用程序数据,但重新启动应用程序后。所有数据都会返回。清除应用程序数据,重新启动后回来
public static void ClearApplicationData() {
File cacheDir = GetCurrentApplication().getCacheDir();
File appDir = new File(cacheDir.getParent());
if (appDir.exists()) {
String[] children = appDir.list();
if (children == null)
return;
for (String s : children) {
if (!s.equalsIgnoreCase("lib"))
{
File dirToDelete = new File(appDir, s);
//delete directory code
}
}
}
}
所以执行上面的代码后,我查了data
目录应用程序的,它只有lib
目录左侧。但是,当我再次运行应用程序时,所有目录都恢复原样。但是如果我使用管理应用程序>应用程序信息>清除数据,所有工作都很好。有什么不同 ?
我想你知道,有“清除数据”和“清除缓存”之间的区别吗? – ozbek