Android Endless list memory management

后端 未结 9 2097
温柔的废话
温柔的废话 2021-02-05 07:42

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 m

9条回答
  •  故里飘歌
    2021-02-05 08:07

    If you need to keep in memory 1M objects, and assuming the object data is small, than theis is just a few MB of memory, and should be fine to just keep in memory. From the question I understand that you will read more items when users scrolls forward, so in practice you will not have 1M rows - users will need to scroll for a long time to get to 1M. As long as you use the ListView properly, you can have the adapter data grow to be 1M+ rows in memory without any issue

提交回复
热议问题