我有一个web视图的活动,并希望缓存内容。在默认情况下,它不显示为使用缓存
I have an activity with a WebView and want to cache content. By default, it does not appear to be using the cache.
Android的 WebSettings 有几个不同的缓存相关的常量。
Android's WebSettings has several different cache-related constants.
当我设置缓存模式,以LOAD_CACHE_ELSE_NETWORK,它似乎使用缓存。不过,我不希望使用过期的缓存内容。
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.
这让我使用:
LOAD_DEFAULT:默认的缓存使用模式或 LOAD_NORMAL:普通缓存的使用模式但文件并没有细说什么是正常和默认的意思。
But the documentation does not elaborate on what "normal" and "default" mean.
如何在这两种模式有什么不同?
How do these two modes differ?
我同意,人们会想到NORMAL_MODE是默认模式,但很明显这是两个不同的值。
I agree, one would expect that NORMAL_MODE is the default mode, but clearly this is two different values.
我想回答问题2(LOAD_NORMAL)中的的WebSettings.setCacheMode(INT模式)文档
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.
上一篇:什么是整数值,给出了一个广播接收机优先级最高的出了、接收机、优先级、整数
下一篇:Android的Eclipse插件"重置ADB"给人"亚行连接错误:EOF"错误,不堵,但它是什么?错误、给人、但它、插件