I am using RemoteMediator
to populate my Viewpager2
. The view pager contains weekly data and it is in RTL format because i have to show data in descending order. current week, last week.... Please refer below pictures.
So i am able to fetch data and populate the DB properly. The problem i am facing is in Error Handling.
I went through LoadState documentation and not able to grasp fully. The LoadstateViewHolder
extends RecyclerViewHolder
. So will it work with ViewPager2
?
The requirement I have is like below :
If there is no data available in cloud, create a page and show "-" as data for all the dates for current week only.
If there is data available in local db and REFRESH is giving any error, PREPEND a page in viewpager with "-" data for current week.
I can not share the code for official purposes.. Any help will be appreciated.. Thanks.