- How to determine size of data returned before setting adapter?
- How to use emptyview with paging library?
- How to set emptyview if pagedlist returns null or no data?
相关问题
- How can I create this custom Bottom Navigation on
- Bottom Navigation View gets Shrink Down
- How to make that the snackbar action button be sho
- Listening to outgoing sms not working android
- How to create Circular view on android wear?
相关文章
- android开发 怎么把图片放入drawable的文件夹下
- android上如何获取/storage/emulated/下的文件列表
- androidStudio有个箭头不认识
- SQLite不能创建表
- Windows - Android SDK manager not listing any plat
- Animate Recycler View grid when number of columns
- Why is the app closing suddenly without showing an
- Android OverlayItem.setMarker(): Change the marker
Simply add a listener or callback function to your
DataSourceFactory
and yourDataSource
and call it if the list inloadInitial
is empty:Update[24/04/19]: I just found out that the library already provide us a way to listen to empty initial load, using
PagedList.BoundaryCallback<YourItem>
.*Note that my old answer is still a valid alternative.
Original Answer:
Based on this class on google sample Network State. Modify it to handle empty content in initialLoad.
Usage as follow:
And this is how the activity handle it:
For more details on how to connect DataSource with Activity, see this sample
In your fragment/activity you are observing network state:
like this:
And in view model you have this function: