3
在我的应用程序,我有一个活动,加载不同的图像的web视图。在加载webview之前,我需要知道图像是否已经缓存在webview缓存中。我发现2.3的Android设备,下这个工作解决方案:检查文件是否已经存在于webview缓存android
String uri = "http://the url of the image that you need";
String hashCode = String.format("%08x", uri.hashCode());
File file = new File(new File(getCacheDir(), "webviewCache"), hashCode);
// if the call file.exist() returns true, then the file presents in the cache
从岗位“Is it possible to access the WebView cache?”但我想找到的所有设备的解决方案,所以任何帮助将不胜感激。5月的WebView缓存目录已更改? 谢谢!
如何在WebView中手动保存文件? – Xiaozou
你可以在这里发布你的代码吗? –