I am trying to implement a SearchView in my room with a view SQLite Database. The app has a RecyclerView with a CardView that displays rows from the database. I am trying to make it so a user can use a SearchView to filter the CardView and only show cards matching the search. I have been following the information in this post: Android - Implementing search filter to a RecyclerView .
Anyway, my app currently uses a LiveData method getAllFlares() and it returns all of the rows from the database. The return is of course of type LiveData. The method of filtering in the link has you pass an ArrayList as an argument to a filtering method. So I was trying to pass the results of getAllFlares() to the filtering method. To make the types match up, I altered the filtering method to accept a LiveData list instead of an ArrayList. Here is the code where I am trying to pass the LiveData list to the filtering method:
LiveData<List<Flare>> flare;
flare = mFlareViewModel.getAllFlares();
adapter.filterFlareList(flare);
But it gives this error like:
updateFlareList (java.util.List<com.android.fibrnah.Flare>) in FlareListAdapter cannot be applied to (androidx.lifecycle.LiveData<java.util.List<com.android.fibrnah.Flare>>)
What am I doing wrong? I feel that there is some fundamental flaw in what I am doing with LiveData.