There is a news aggregator. Articles are downloaded from the network, and stored in local SQLite . The UI is organized in the standard way: RecyclerView , whose elements are previews of articles.
The question is: how to optimally organize the loading of data into RecyclerView from SQLite , if ≈ 3 elements fit on the screen?
Let me explain: in this matter, the time for loading articles from the network, their placement in the database and the time for converting articles into previews is ignored. Interested in the mechanism of loading elements in RecyclerView for one request and the organization of this loading. The standard mechanism (we load some elements -> the user scrolls the list to the end -> we load a new portion of elements) does not fit.
For example, maybe you should catch the scrolling in the middle of the list and then start uploading new data ? In addition, it is possible that a respected community has experience on how many elements from SQLite optimally collected in a single query? Because there is a suspicion that the loading of 3 elements from SQLite will be approximately equal to the loading time of 30 elements, since Most of the time is spent on the transaction itself, but let's say, it’s not optimal to request 300 items per request.
SQLiteCursorhas aCursorWindowbuffer, about 2 MB in size. And if your query pulls out> 2 MB, there will already be a relatively large overhead in time from theSQLiteCursor. - Alex KiselSQLiteCursorwith large queries, see this article - Alex Kisel