I\'m using RecyclerView
to display name of the items. My row contains single TextView
. Item names are stored in List
Avoid notifyDatasetHasChanged() and do the following:
public void setItems(ArrayList newArticles) {
//get the current items
int currentSize = articles.size();
//remove the current items
articles.clear();
//add all the new items
articles.addAll(newArticles);
//tell the recycler view that all the old items are gone
notifyItemRangeRemoved(0, currentSize);
//tell the recycler view how many new items we added
notifyItemRangeInserted(0, articles.size());
}