How to delete the project cache:
Getcachedir () can get the cache address of the current project
The webview control is often used in projects. When an HTML page is loaded, the database and cache folders are generated under the/data/application package directory. The requested URL record is saved in webviewcache. dB, and the URL content is saved in the webviewcache folder.
Enable and disable Cache Usage. There are five types
// Cache is preferred:
Webview. getsettings (). setcachemode (websettings. load_cache_else_network );
// Do not use cache:
Webview. getsettings (). setcachemode (websettings. load_no_cache );
Add the following when exiting the application:Code
File file = cachemanager. getcachefilebasedir ();
If (file! = NULL & file. exists () & file. isdirectory ()){
For (File item: file. listfiles ()){
Item. Delete ();
}
File. Delete ();
}
Context. deletedatabase ("webview. DB ");
Context. deletedatabase ("webviewcache. DB ");