Search code examples
androidandroid-architecture-componentsandroid-paging

Android Google Paging library not working


I'm trying to implement the google's paging library in my project. All things are already coded and network call is working in loadInitial() But it never goes in loadAfter(). As code structure is very complex I am not posting code directly here.

Here's the repository :

https://github.com/raghavsatyadev/PagingDemo

File link : https://github.com/raghavsatyadev/PagingDemo/blob/master/app/src/main/java/com/rocky/invmx/modules/order/OrdersActivity.java


Solution

  • You are overriding getItem(int index) method in GenPagingRecyclerAdapter.java class without calling the super.getItem(index). If you look at the PagedListAdapter.java and dig into the method call you will see that this method internally calls the loadAfter method. So first the solution to your problem is to remove the getItem(int index) from GenPagingRecyclerAdapter.java class. Because you are not doing anything in it and if you really want to override getItem(int index) then call the super.getItem(int index) at start.