Recycler View Add Remove Item Animation not showing in swapCursor

How to implement the Retycler View Default Add / Remove Animations object in the swapCursor function. notifyDataSetChanged () will not display animations.

public void swapCursor(Cursor newCursor) { mCursor = newCursor; notifyDataSetChanged(); } 
+4
source share
1 answer

Just set the following in activity:

 recyclerView.setHasFixedSize(true); 

And write in the adapter

  setHasStableIds(true); //in constructor @Override public long getItemId(int position) { return cameraImageArrayList.get(position).hashCode(); //Any unique id } 
+10
source

All Articles