I got an activity that shows a list of items to the user and it uses the Paging Library. My problem is that I can\'t reload the list when user swipes down the screen so that
Add a method in ViewModel class
public void refresh() {
itemDataSourceFactory.getItemLiveDataSource().getValue().invalidate();
}
and from the Activity/Fragment you can use
swipeRefreshLayout.setOnRefreshListener(() -> yourviewModel.refresh());
Hide the refresh layout when the reyclerView gets loaded
yourViewModel.itemPagedList.observe(this, allProposalModel -> {
mAdapter.submitList(model);
swipeRefreshLayout.setRefreshing(false); //here..
});