Search code examples
androidperformanceandroid-recyclerviewandroid-memory

Android Very huge list of items with recyclerview best approach


i develops a app and i got the following problem: I need to show a list of items, each item is composed from the following fields: 3 longs, 2 inits, 3 Strings. The list needs to support: Fast scrolling. Filltering.

The data is in a database locally and there no need to access the web.

The list can be with a huge amount of data, for example 1,000,000 items.

I would like to ask what is the best approach to handle this, in term of memory and performance.

Is using approach of loading on demand will give a reasonable performance? Is holding that amount of objects in memory will consume too much RAM?

I would like to hear other opinions on this matter. Thanks in advance, and sorry about my bad english.


Solution

  • You answer is RecyclerView, long, int and String. In terms of performances, RecyclerView is recycling views by itself when are no more visible and will provide a fast scroll and you can make more faster if you use cache. Also you can set null to views when view is recycled. In terms of memory, use basic objects like int, not Integer, long, not Logint, etc.