PagedList.BoundaryCallback
  public
  static
  
  abstract
  class
  PagedList.BoundaryCallback
  
    extends Object
  
  
  
  
  
  
| java.lang.Object | |
| ↳ | android.arch.paging.PagedList.BoundaryCallback<T> | 
Signals when a PagedList has reached the end of available data.
 When local storage is a cache of network data, it's common to set up a streaming pipeline:
 Network data is paged into the database, database is paged into UI. Paging from the database
 to UI can be done with a LiveData<PagedList>, but it's still necessary to know when
 to trigger network loads.
 
 BoundaryCallback does this signaling - when a DataSource runs out of data at the end of
 the list, onItemAtEndLoaded(Object) is called, and you can start an async network
 load that will write the result directly to the database. Because the database is being
 observed, the UI bound to the LiveData<PagedList> will update automatically to
 account for the new items.
 
 Note that a BoundaryCallback instance shared across multiple PagedLists (e.g. when passed to
 setBoundaryCallback(PagedList.BoundaryCallback), the callbacks may be issued multiple
 times. If for example onItemAtEndLoaded(Object) triggers a network load, it should
 avoid triggering it again while the load is ongoing.
 
BoundaryCallback only passes the item at front or end of the list. Number of items is not passed, since it may not be fully computed by the DataSource if placeholders are not supplied. Keys are not known because the BoundaryCallback is independent of the DataSource-specific keys, which may be different for local vs remote storage.
The database + network Repository in the PagingWithNetworkSample shows how to implement a network BoundaryCallback using Retrofit, while handling swipe-to-refresh, network errors, and retry.
Summary
| Public constructors | |
|---|---|
| 
      PagedList.BoundaryCallback()
       | |
| Public methods | |
|---|---|
| 
        
        
        
        
        
        void | 
      onItemAtEndLoaded(T itemAtEnd)
      Called when the item at the end of the PagedList has been loaded, and access has
 occurred within  | 
| 
        
        
        
        
        
        void | 
      onItemAtFrontLoaded(T itemAtFront)
      Called when the item at the front of the PagedList has been loaded, and access has
 occurred within  | 
| 
        
        
        
        
        
        void | 
      onZeroItemsLoaded()
      Called when zero items are returned from an initial load of the PagedList's data source. | 
| Inherited methods | |
|---|---|
Public constructors
PagedList.BoundaryCallback
PagedList.BoundaryCallback ()
Public methods
onItemAtEndLoaded
void onItemAtEndLoaded (T itemAtEnd)
Called when the item at the end of the PagedList has been loaded, and access has
 occurred within prefetchDistance of it.
 
No more data will be appended to the PagedList after this item.
| Parameters | |
|---|---|
| itemAtEnd | T: The first item of PagedList | 
onItemAtFrontLoaded
void onItemAtFrontLoaded (T itemAtFront)
Called when the item at the front of the PagedList has been loaded, and access has
 occurred within prefetchDistance of it.
 
No more data will be prepended to the PagedList before this item.
| Parameters | |
|---|---|
| itemAtFront | T: The first item of PagedList | 
onZeroItemsLoaded
void onZeroItemsLoaded ()
Called when zero items are returned from an initial load of the PagedList's data source.
- Interfaces
- Classes- AsyncPagedListDiffer
- DataSource
- DataSource.Factory
- ItemKeyedDataSource
- ItemKeyedDataSource.LoadCallback
- ItemKeyedDataSource.LoadInitialCallback
- ItemKeyedDataSource.LoadInitialParams
- ItemKeyedDataSource.LoadParams
- LivePagedListBuilder
- PagedList
- PagedList.BoundaryCallback
- PagedList.Builder
- PagedList.Callback
- PagedList.Config
- PagedList.Config.Builder
- PagedListAdapter
- PageKeyedDataSource
- PageKeyedDataSource.LoadCallback
- PageKeyedDataSource.LoadInitialCallback
- PageKeyedDataSource.LoadInitialParams
- PageKeyedDataSource.LoadParams
- PositionalDataSource
- PositionalDataSource.LoadInitialCallback
- PositionalDataSource.LoadInitialParams
- PositionalDataSource.LoadRangeCallback
- PositionalDataSource.LoadRangeParams
- RxPagedListBuilder
 
