I have a list which contains plenty of data so I have implemented the lazy loading in to the list which loads 10 items for each swipe down. But I am stuck in a scenario, i.e, I am loading 10 items at a time but If any user wants to search using searchview I have to search entire db and prepare the same list with this results and when the searchview is cleared I have to load the previously loaded list. Can anybody help me to solve this. I have not posted the code because of security reasons. Kindly please suggest a way to solve this.
Thanks
Consider using Recyclerview. It would improve the performance on the device even if there are huge number of items.
You can place all your items (lets say 1000 items) in the recyclerview in conjunction with cardview. So would not need to bother about the swipe and load functionality. All your items would be stored in the recyclerview adaptor's viewmodel. You can perform the search within the adaptor and display the filtered results (assuming the data in the list is not exceptionally huge).
https://developer.android.com/reference/android/support/v7/widget/RecyclerView.html