Prevent Android WebView caching data

后端 未结 2 629
南方客
南方客 2020-12-24 04:28

Is it possible to prevent a WebView from caching data in /data/data/???/cache/webViewCache? I\'ve set the following on the WebSettings but the cache folder is still used:

2条回答
  •  北海茫月
    2020-12-24 05:02

    In my application (on Android 4.2.2) I load on a webview a web page with images that I can change at runtime (I replace the images while keeping the path). The Matt's solution (1)

    @Override
    public void onPageFinished(WebView view, String url) {
        super.onPageFinished(view, url);
        view.clearCache(true);
    }
    

    works for me, the solution (2) no! Cheers

提交回复
热议问题