Monday 28 September 2020

AsyncListDiffer doesn't refresh at correct time

I am trying to create chat app with firebase. I try to search users by their username and when I get a result which matches the search query, I add that to list and postValue with MutableLiveData. I observe that MutableLiveData and submit new List to Adapter differ:

 viewModel.users.observe(viewLifecycleOwner, {
            adapter.differ.submitList(it)
            Log.d("SearchUserFragment","list content: $it")
        })

By logging I make sure that I have gotten the expected result and yeah, I get what I want. But after calling submitList I expect recyclerView to get updated but it doesn't. I have to close keyboard or reselect EditText to see changes. How can I solve this problem or did I totally misunderstand how differ works?

enter image description here



from AsyncListDiffer doesn't refresh at correct time

No comments:

Post a Comment