Smart way to update RecyclerView using DiffUtil
Say Good Bye To notifyDataSetChanged() We generally use List in any of our day to day development. It also requires to update the list data when user scrolls the list. To achieve this, we often fetch the data from server and update the newly received items. If there is a small delay during this process it impact on the user experience so we want this to be done as soon as possible with along with less resources. When the content of our list gets changed, we have to call notifyDataSetChanged() to get the updates but it is very costly. There are so many iterations for getting the job done in the case of notifyDataSetChanged(). Here DiffUtil class comes into picture and Android developed this utility class to handle data updates for a RecyclerView. What is DiffUtil As of 24.2.0, RecyclerView support library, v7 package offers really handy utility class called DiffUtil. This class finds the difference betwe...