Is it normal for 3 seconds to load a recyclerview with data from 16,000 records in sqlite?
Is there any way to optimize the upload?
Is it normal for 3 seconds to load a recyclerview with data from 16,000 records in sqlite?
Is there any way to optimize the upload?
As the friend mentioned above and looking at your code, you do not have to load the entire base at once, it will only cost performance and memory of the device.
RecyclerView is designed to work with large amounts of data precisely because it only loads in memory the data that is visible on the screen, while the Adapter does all that management during a scroll to discard the data leaving the screen or search for new base data when they appear on the screen.
For this you have to implement a Content Provider in your app to intermediate the base accesses (and allow you to search for specific data that you mentioned in a comment above) and implement a CursorLoader in your Activity to keep RecyclerView automatically always up to date when base is modified.Take a look at this free. It explains very well everything I just said:
It's normal, yes. and need not be as many records. A good part of this time is the assembly of the resource in the device memory. The options are:
Improve the query. Why charge 16,000 records at once?
Use content provider
and loader
to take care of loading recycler view
... And improve query.
EDIT: In response to your comments, expanding the answer.
You have to understand that filosofia
of a mobile app is different from that of a desktop system. On the desktop, it may even make sense to load a large amount of data, but on the mobile, the user opens and closes the app in seconds. If your app uses these seconds to load thousands of records, before the load is finished, the user has already closed.
As for your idea of loading a few data into the list, it may be a solution, but I'll suggest the Google model.
No information shows until you start typing, when a list of suggestions appears.
You will find the answer to your dilemma by combining content provider
, loader
and auto complete