I called clearCache in an Android WebView to delete the cache. However, I found out that this method works globally for the application’s WebView.
clearCache
Added in API level 1
public void clearCache (boolean includeDiskFiles)
Clears the resource cache. Note that the cache is per-application, so this will clear the cache for all WebViews used.
Parameters
includeDiskFiles boolean: if false, only the RAM cache is cleared
So, I found an alternative: WebSettings.LOAD_NO_CACHE. Is this setting global or does it apply only to the specific WebView object?
Feel free to ask if you need any more help!
//is called
webView?.clearCache(true)
//i want this
webview.WebSettings.LOAD_NO_CACHE
New contributor
choi is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.