Okn
Okn

Reputation: 698

Android - disable notifydatasetchanged for existing items

Is it possible to disable the refresh of the RecyclerView for the items already existing ? Because when I refresh the RecyclerView after adding new items, we can see visually the refreshing of the RecyclerView. I think we can see the refreshing because of the ImageView in each items.

So I want to disable notifydatasetchangedfor existing items.

Upvotes: 0

Views: 908

Answers (1)

wasyl
wasyl

Reputation: 3506

If you're using RecyclerView, you should use [notifyItemRangeInserted](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.Adapter.html#notifyItemRangeInserted(int, int)) method (and friends) to refresh only items that were added, instead of notifyDatasetChanged. You can also refresh only items that have changed (notifyItemChanged) or that an item has moved (notifyItemMoved)

Upvotes: 1

Related Questions