1) Insert single item at any position:String value = “India”;int index = 2;dataList.add(index, value);adapter.notifyItemInserted(index);This will add India at position 2.2) Insert multiple items:int index = 3;dataList.add(index,”Australia”);dataList.add(index,”England”);dataList.add(index,”South Africa”);adapter.notifyItemRangeInserted( index, dataList.size());Australia will be listed at position 3, England will be listed at position 4 and South Africa will be listed at position 53) Remove single item from any position:int index = 4;dataList.remove( index);adapter.notifyItemRemoved(index);This will remove England from the RecyclerView.4) Remove multiple items:int startIndex = 2;int endIndex = 4;int count = endIndex – startIndex;dataList.subList(startIndex, endIndex).clear();adapter.notifyItemRangeRemoved(startIndex, count);This will remove 2 items at position 2 and 3.5) Remove all items:dataList.clear();adapter.notifyDataSetChanged();6) Replace old list with new list:dataList.clear();// add new listArrayList newList = new ArrayList();newList.add(“Sri Lanka”);newList.add(“Bangladesh”);newList.add(“Pakistan”);dataList.addAll(newList);// notify adapteradapter.notifyDataSetChanged();This will replace the old values with new one.7) Update single item:String newValue = “India”;int updateIndex = 2;dataList.set(updateIndex, newValue);adapter.notifyItemChanged(updateIndex);This is replace Pakistan with India8) Change position of a single item:int fromPosition = 2;int toPosition = 0;// update data arrayString item = dataList.get(fromPosition);dataList.remove(fromPosition);dataList.add(toPosition, item);// notify adapteradapter.notifyItemMoved(fromPosition, toPosition);This will move India from Postion 3 to 0. This are the various ways you can update recyclerview
How to update RecyclerView in Android
We're Ready, Let's Talk

Best OTT Platforms and Apps Worldwide
web idea solution
December 16, 2022

How to choose the best eCommerce Website Development Company for Your Business?
web idea solution
July 25, 2022

Hire Dedicated Software Developers in India: A Basic Guide
web idea solution
August 30, 2022

How to Build a Food Ordering App Like Zomato, Swiggy & Eatsure?
web idea solution
May 24, 2024

How You Can Transform Your Business in Kolkata with a Top Digital Marketing Company
Rakesh
January 28, 2025













































































































