Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between LOAD_DEFAULT and LOAD_NORMAL for WebSettings?

I have an activity with a WebView and want to cache content. By default, it does not appear to be using the cache.

Android's WebSettings has several different cache-related constants.

When I set the cache mode to 'LOAD_CACHE_ELSE_NETWORK', it appears to use the cache. However, I don't want to use expired cache content.

This leaves me with using:

  1. LOAD_DEFAULT: "Default cache usage pattern" or
  2. LOAD_NORMAL: "Normal cache usage pattern"

But the documentation does not elaborate on what "normal" and "default" mean.

How do these two modes differ?

like image 505
Jeremy Haberman Avatar asked Jun 27 '11 15:06

Jeremy Haberman


People also ask

Which method can be used to retrieve WebSettings?

When a WebView is first created, it obtains a set of default settings. These default settings will be returned from any getter call. A WebSettings object obtained from WebView#getSettings() is tied to the life of the WebView.

Which method can be used to retrieve Web setting in Android?

Configuring WebView Settings with WebSettings getSettings() object if a WebView is already destroyed. You can retrieve WebSettings with WebView. getSettings() API.


1 Answers

I agree, one would expect that NORMAL_MODE is the default mode, but clearly this is two different values.

I think answer to question 2. (LOAD_NORMAL) is answered in the documentation for WebSettings.setCacheMode(int mode)

For a normal page load, the cache is checked and content is re-validated as needed. When navigating back, content is not revalidated, instead the content is just pulled from the cache. This function allows the client to override this behavior.

like image 139
J.G.Sebring Avatar answered Oct 03 '22 00:10

J.G.Sebring