While using a ListAdapter I noticed that after updating an item the DiffUtil.ItemCallback areContentsTheSame() method was always returning true. De
I have 0 reputation so I can't comment, but @Shadow's answer worked for me.
I am also working with Room + LiveData + ViewModel + DiffUtil and editing the contents of a list item with a dialog. Although java is pass by value, when we pass a value of an object were actually passing the reference to it. So when you edit the contents of the same object in say a dialog you're actually changing the same reference of the list item, hence why DiffUtil cannot calculate difference when LiveData does an onChange.
This explains java pass by value/reference better: Is Java "pass-by-reference" or "pass-by-value"?
What I did:
Item newItem = new ItemBuilder().setId(oldItem.getId()).......
Then make changes to newItem, then update the DB from viewModel