如何缓存,离线模式的网页内容? [英] How to cache web content for offline mode?

查看:241
本文介绍了如何缓存,离线模式的网页内容?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发了应用程序应该读在线存储(网站,这仅仅是为了这个目的,待建)产品图片和价格的应用程序的一部分,使产品的图片和价格,让本地存储它可以展示产品图片和价格,当它处于脱机状态。会有一个按钮;一旦它是pressed,它的工作是到本地缓存同步。我怎么能实现呢?任何帮助将是非常美联社preciated。

I'm developing a part of an app where application is supposed to read product-images and prices from online storage (website, which is to be built for this purpose only), make local storage of product-images and prices so that it could show the product-images and prices when it is offline. there will be a button; once it is pressed, its job is to synchronize the local cache. How could I implement this ? Any help would be highly appreciated.

先谢谢了。

推荐答案

您可以缓存使用磁盘高速缓存的远程服务的位图,有关于如何做到这一点的谷歌开发者网站的 http://developer.android.com/training/displaying-bitmaps/cache-bitmap.html

You can cache the bitmaps from a remote service using a Disk Cache, there is more information about how to do this on the Google developer site http://developer.android.com/training/displaying-bitmaps/cache-bitmap.html

这将允许你存储的图像,并立即显示如果没有连接,或者您想要加载的图像,同时装载远程图像。

This will allow you to store the images and display immediately if there is no connection, or you want to load the images whilst loading the remote images.

根据您需要存储您可以在缓存或图像或者建立一个ArrayList的数据文本关联,并存储在磁盘什么文字。这里一些细节最佳的方式来缓存数据在Android中

Depending on what text you need to store you can associate the text with the images in the cache or alternatively set up an ArrayList with the data and store to disk. Some more details here Best Way to Cache Data in Android

还有一些工具周围,以确保您充分利用您的网络连接,如AT&放大器;吨的ARO工具,运行这将帮助你减少你的网络优化您的应用程序调用到最低限度。请参见 http://developer.att.com/aro

Also there are tools around to ensure you are making the most of your network connections, such as the AT&T ARO tool, running this will help you to optimize your app by reducing your network calls to a minimum. See http://developer.att.com/aro

这篇关于如何缓存,离线模式的网页内容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆