Hello everyone, is there a way to make paging display always a fixed number of items? I have a Realtime database which can reach thousands of items so it's not good idea to keep loading items to memory and make the app slow. Also I need to search/filter items by phone number in the entire list from the Realtime database. Is there something like this already done? How could I do this?
I'm thinking of using Room to store all the items from DB so I can search easily. Now the part of keeping a fixed number of elements in the pager I don't have an idea.
10/31/2021, 3:14 PM
pager is a recyclerview so even you adding 1000 items to it, it will only load the visible ones
you can just try the performance if you want adding any number of items to a recyclerview
10/31/2021, 3:35 PM
If itemsShown.size >= yourMax // don’t fetch more data
10/31/2021, 6:01 PM
no, when filling the adapter with thousands of items it's very slow! locking the entire UI.
10/31/2021, 9:37 PM
Yeah you shouldn’t do that
11/02/2021, 9:15 AM
The problem is, there is no API to paginate Firebase Realtime Database data and also maintain the real-time update on the items displayed.