I have a RecyclerView recyclerView
which is linked to a ListAdapter adapter
. The 'list' gets new data from Firebase database and the 'list' gets sorted based on certain object properties. I then call adapter.submitList(list)
to update the recyclerView - this works perfectly!
But, I want the recyclerView to scroll to the top of the list after the new data is added. But I see that adapter.submitList(list)
runs on a separate thread. So how would I go about knowing when it is done submitting and call recyclerView.smoothScrollToPosition(0);
Let me know if I should provide more details.