-1

I am trying to search and update the recycler View which take its value from Room Data Base and user SearchView but I can't find a way to update the recycler view since I am using List Adapter and DiffUtill.

MadLeo
  • 458
  • 1
  • 6
  • 24
Airits H
  • 49
  • 3

1 Answers1

0

If you are using the new ListAdapter, then you shouldn't need to search and update the RecyclerView when anything changes in the list. The purpose of the ListAdapter is to simply just submit a list to it. Each submission of a new list will trigger DiffUtil.ItemCallback to calculate the difference between the old list and newly submitted list, which will tell the adapter how to rearrange based off those results.

I made a sample reddit reader not too long ago that encapsulates every library you mentioned doing this whenever the Feed was refreshed.

Unless your intention was to do something more complex, some more details would greatly help us to help you. This article on medium also does a great job at explaining the role of a ListAdapter.

Andrew Steinmetz
  • 1,010
  • 8
  • 16
  • no the update I ma talking about is the update of the searchView it self , like whrn I type a word in the searchDilog it want be shown in the recycler View – Airits H Aug 10 '19 at 05:26
  • @Andrew Steinmetz Can I ask you to help me with my question https://stackoverflow.com/questions/57675926/using-recyclerview-with-diffutil-itemcallback-doesnt-scroll-to-top – I.S Aug 27 '19 at 18:39