I\'m using the android paging library to show search result items, is there any way I can clear/remove all the loaded result items, Calling Invalidate on live Paged List refresh
In Java:
I cleared all items on in PagedListAdapter by calling invalidate() on DataSource instance like that
public void clear(){
movieDataSource.invalidate();
}
Add this method in your ViewModel then call it in your activity
movieViewModel.clear();
movieAdapter.notifyDataSetChanged();
Then Load any data you want
You can see how I made it in my project.
Here is the Link: https://github.com/Marwa-Eltayeb/MovieTrailer