RecyclerView is not behaving properly when added as child of a NestedScollView (New Items added to RecyclerView taking more than 2 mins to reflect)
RecyclerView is not behaving properly when added as child of a NestedScollView
PROBLEM - notifyItemRangeInserted(int positionStart, int itemCount) method of RecyclerView is taking more than 2 mins to add the new Items views to the window.
a. When the positionStart = 0, it is adding the the items instantly, but as all the items are getting rebind to the adapter again, images are also reloaded again. So this is not the best practice to use positionStart = 0.
b. When the positionStart = currentSize + 1, it is taking more than 2 mins to add the newly added items.
EXPECTED BEHAVIOR - It should add the views within fraction of seconds.
NOTE - Probably this is happening, because the RecyclerView added inside a NestedScrollView. Please look into this issue as it is restricting the developers to use this component while using NestedScrollView as its parent view to achieve the UI design.
CODE SNIPPET :
===================================================================
if (productList != null && productList.getData().size() > 0) {
int currentSize = adapter.getItemCount(); // Getting current items Count
adapter.addToProductsList(productList); // Adding new items to the existing list
adapter.notifyItemRangeChanged(currentSize+1, adapter.getItemCount());
===================================================================
2 Answer(s)