Skip to content

Most visited

Recently visited

navigation

LivePagedListProvider

public abstract class LivePagedListProvider
extends Object implements Factory<Key, Value>

java.lang.Object
   ↳ android.arch.paging.LivePagedListProvider<Key, Value>


This class is deprecated.
use LivePagedListBuilder to construct a LiveData<PagedList>. It provides the same construction capability with more customization, and simpler defaults. The role of DataSource construction has been separated out to DataSource.Factory to access or provide a self-invalidating sequence of DataSources. If you were acquiring this from Room, you can switch to having your Dao return a DataSource.Factory instead, and create a LiveData<PagedList> with a LivePagedListBuilder.

Provides a LiveData<PagedList>, given a means to construct a DataSource.

Return type for data-loading system of an application or library to produce a LiveData<PagedList>, while leaving the details of the paging mechanism up to the consumer.

See also:

Summary

Public constructors

LivePagedListProvider()

Public methods

LiveData<PagedList<Value>> create(Key initialLoadKey, PagedList.Config config)

Creates a LiveData of PagedLists, given the PagedList.Config.

LiveData<PagedList<Value>> create(Key initialLoadKey, int pageSize)

Creates a LiveData of PagedLists, given the page size.

DataSource<Key, Value> create()

Create a DataSource.

Protected methods

abstract DataSource<Key, Value> createDataSource()

Construct a new data source to be wrapped in a new PagedList, which will be returned through the LiveData.

Inherited methods

From class java.lang.Object
From interface android.arch.paging.DataSource.Factory

Public constructors

LivePagedListProvider

LivePagedListProvider ()

Public methods

create

LiveData<PagedList<Value>> create (Key initialLoadKey, 
                PagedList.Config config)

Creates a LiveData of PagedLists, given the PagedList.Config.

This LiveData can be passed to a PagedListAdapter to be displayed with a RecyclerView.

Parameters
initialLoadKey Key: Initial key to pass to the data source to initialize data with.

config PagedList.Config: PagedList.Config to use with created PagedLists. This specifies how the lists will load data.

Returns
LiveData<PagedList<Value>> The LiveData of PagedLists.

create

LiveData<PagedList<Value>> create (Key initialLoadKey, 
                int pageSize)

Creates a LiveData of PagedLists, given the page size.

This LiveData can be passed to a PagedListAdapter to be displayed with a RecyclerView.

Parameters
initialLoadKey Key: Initial key used to load initial data from the data source.

pageSize int: Page size defining how many items are loaded from a data source at a time. Recommended to be multiple times the size of item displayed at once.

Returns
LiveData<PagedList<Value>> The LiveData of PagedLists.

create

DataSource<Key, Value> create ()

Create a DataSource.

The DataSource should invalidate itself if the snapshot is no longer valid. If a DataSource becomes invalid, the only way to query more data is to create a new DataSource from the Factory.

LivePagedListBuilder for example will construct a new PagedList and DataSource when the current DataSource is invalidated, and pass the new PagedList through the LiveData<PagedList> to observers.

Returns
DataSource<Key, Value> the new DataSource.

Protected methods

createDataSource

DataSource<Key, Value> createDataSource ()

Construct a new data source to be wrapped in a new PagedList, which will be returned through the LiveData.

Returns
DataSource<Key, Value> The data source.

This site uses cookies to store your preferences for site-specific language and display options.

Get the latest Android developer news and tips that will help you find success on Google Play.

* Required Fields

Hooray!

Follow Google Developers on WeChat

Browse this site in ?

You requested a page in , but your language preference for this site is .

Would you like to change your language preference and browse this site in ? If you want to change your language preference later, use the language menu at the bottom of each page.

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a short survey?
Help us improve the Android developer experience. (Dec 2017 Android Platform & Tools Survey)