Prithniraj Nicyone
Prithniraj Nicyone

Reputation: 5111

how to enable caching in webview android

I want to enable caching in webview android. I am loading an url in webview what I want is when I open the same url again in webview, it should load that url from cache in order to faster loading, how can I achieve this?

Upvotes: 10

Views: 13004

Answers (1)

Maroof Mandal
Maroof Mandal

Reputation: 531

You can use the WebView cache to enable caching in WebView.

In the properties of the WebView add the following line:

webView.getSettings().setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);

Upvotes: 16

Related Questions