How to control the behavior of RecyclerView?

When booting from the network information in a RecyclerView is placed for 100 items, made so that when it reaches the end of the list loaded another 100 and so on.

But when new records are added to the list automatically resets to the top of the list. And I need to keep it in place, and the record just added, but nothing with the list is not happening!

My code

Question:
How to make so that the RecyclerView is opened at the given position (or when change is not escaped in the beginning )?
July 12th 19 at 17:24
1 answer
July 12th 19 at 17:26
Solution
This is because you recreate the adapter every time for some reason. You need to add new elements to an existing adapter, call RecyclerView.Adapter#notifyItemRangeInserted() or RecyclerView.Adapter#notifyDatasetChanged() after that.

What about the transition to the position: RecyclerView#scrollToPosition()
thank you !!! - maxime commented on July 12th 19 at 17:29

Find more questions by tags AndroidMobile development