缓存的URL,而无需打开他们的android [英] Cache urls without opening them android
问题描述
是否可以缓存网站网址,图片网址等的列表而不网页视图首先打开呢?我的img网址,饲料来,我想缓存上下载的列表。我已经发布了关于这个问题,但已经变得没有反应这是我的previous问题。 (缓存图像的URL的Android )
Is it possible to cache a list of website urls, image urls etc without opening them first in a webview? I have a list of img urls coming from a feed that i want to cache on download. i have already posted a question about this but have gotten no response here is my previous question. (Cache image urls android)
推荐答案
这是不可能直接砸的东西进入的WebView缓存。这不会需要preloading在关闭屏幕的WebView的唯一方法(这是完全可能,顺便说一句)将是你自己下载图像,并利用它们服务回的WebView <一个href=\"http://developer.android.com/reference/android/webkit/WebViewClient.html#shouldInterceptRequest%28android.webkit.WebView,%20java.lang.String%29\"相对=nofollow> shouldInterceptRequest 。
It's not possible to drop things into the WebView's cache directly. The only way that would not require preloading in an "off-screen" WebView (which is totally possible, btw.) would be to download the images yourself and serve them back to the WebView using shouldInterceptRequest.
我会建议谨慎使用基于shouldInterceptRequest的方法虽然。这很容易损害性能使用shouldInterceptRequest时(在这里看到 )。另外,你需要从你的缓存删除一些无用的图像的照顾。
I would recommend caution with the shouldInterceptRequest-based approach though. It's easy to hurt performance when using shouldInterceptRequest (see here). Also, you need to take care of removing stale images from your 'cache'.
这篇关于缓存的URL,而无需打开他们的android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!