I have a code to clear application data, but after restarting the application. All data comes back.
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
}
}
}
}
So after executing the above code, I checked the data
dir of application and it only had lib
directory left. But as I run application again, all directories back as they were before. But if I use Manage Application > App Info > Clear Data, all works good. Whats the difference ?