如何缓存在Android的列表视图数据? [英] How to cache listview data in android?

查看:140
本文介绍了如何缓存在Android的列表视图数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含100行的列表视图。这是我第一次从web服务加载的所有数据。我想缓存的数据,因此,如果我打开网页,我应该从高速缓存未从WebService得到它。我怎样才能做到这一点?

I have a Listview that contains 100 rows. This is the first time I load all the data from a Webservice. I want to cache that data so that if I open that page I should get it from cache not from the Webservice. How can I do this?

推荐答案

如果您的数据是很简单的,只要把它们存储在一个数组,并使用类似的 ArrayAdapter 以数据的列表视图绑定

If your data is simple enough, just store them in an array and use something like ArrayAdapter to bind the data to the list view.

如果您的数据更加复杂,那么SQLite表大概是preferable。在这种情况下使用类似的 SimpleCursorAdapter

If your data is more complex, then an SQLite table is probably preferable. In this case use something like SimpleCursorAdapter.

这篇关于如何缓存在Android的列表视图数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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