Android的无尽列表的内存管理 [英] Android Endless list memory management

查看:157
本文介绍了Android的无尽列表的内存管理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通过加载更多的项目在onScrollStateChanged(...)方法的ArrayList实现无尽的列表视图。如果我实施这个计划包括获取超过100万个条目,我将不得不加入到ArrayList,这是内存密集型百万的对象。我可以使用高效的内存管理有什么计划?

I'm implementing an endless listview by loading more items to the arraylist in the onScrollStateChanged(...) method. If I'm implementing this scheme for fetching more than 1 million entries, I will have a million objects added to the arraylist, which is memory intensive. What schemes can I use for efficient memory management ?

PS:问题是有关可以装进适配器的项数。 编辑:

PS: The question is about the number of items that can be put into the adapter.

详细信息:

的数据的源是因特网。我有来从互联网的数据,并把它放入列表视图适配器。

The source of the data is Internet. I have to fetch the data from the Internet and put it into the listview adapter.

推荐答案

我觉得你应该保持目前的条目,一个之前或之后他们(也许100),把这个数据传送到高速缓存。

I think you should just keep the current entries and the one just before or after them(maybe 100),put this data to a cache.

当您滚动您的列表视图,获取更多的条目并更新缓存之前(不要送1亿一次)。

When you scroll your listview,fetch more entries and update the cache as before(do not get 1 million at one time).

这篇关于Android的无尽列表的内存管理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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