Android 12 Developer Preview is here! Try it out, and give us your feedback!

LivePagedListBuilder

class LivePagedListBuilder<Key : Any, Value : Any>
kotlin.Any
   ↳ androidx.paging.LivePagedListBuilder

Builder for LiveData<PagedList> for Java users, given a androidx.paging.DataSource.Factory and a androidx.paging.PagedList.Config.

The required parameters are in the constructor, so you can simply construct and build, or optionally enable extra features (such as initial load key, or BoundaryCallback).

Summary

Public constructors
<init>(dataSourceFactory: DataSource.Factory<Key, Value>, config: PagedList.Config)

Creates a LivePagedListBuilder with required parameters.

<init>(dataSourceFactory: DataSource.Factory<Key, Value>, pageSize: Int)

Creates a LivePagedListBuilder with required parameters.

<init>(pagingSourceFactory: () -> PagingSource<Key, Value>, config: PagedList.Config)

Creates a LivePagedListBuilder with required parameters.

<init>(pagingSourceFactory: () -> PagingSource<Key, Value>, pageSize: Int)

Creates a LivePagedListBuilder with required parameters.

Public methods
LiveData<PagedList<Value>>

Constructs the LiveData<PagedList>.

LivePagedListBuilder<Key, Value>

Sets a androidx.paging.PagedList.BoundaryCallback on each PagedList created, typically used to load additional data from network when paging from local storage.

LivePagedListBuilder<Key, Value>

Set the CoroutineScope that page loads should be launched within.

LivePagedListBuilder<Key, Value>
setFetchExecutor(fetchExecutor: Executor)

Sets Executor used for background fetching of PagedLists, and the pages within.

LivePagedListBuilder<Key, Value>
setInitialLoadKey(key: Key?)

First loading key passed to the first PagedList/DataSource.

Public constructors

<init>

LivePagedListBuilder(
    dataSourceFactory: DataSource.Factory<Key, Value>,
    config: PagedList.Config)

Creates a LivePagedListBuilder with required parameters.

Parameters
dataSourceFactory: DataSource.Factory<Key, Value> DataSource factory providing DataSource generations.
config: PagedList.Config Paging configuration.

<init>

LivePagedListBuilder(
    dataSourceFactory: DataSource.Factory<Key, Value>,
    pageSize: Int)

Creates a LivePagedListBuilder with required parameters.

This method is a convenience for:

LivePagedListBuilder(dataSourceFactory,
        new PagedList.Config.Builder().setPageSize(pageSize).build())
Parameters
dataSourceFactory: DataSource.Factory<Key, Value> DataSource.Factory providing DataSource generations.
pageSize: Int Size of pages to load.

<init>

LivePagedListBuilder(
    pagingSourceFactory: () -> PagingSource<Key, Value>,
    config: PagedList.Config)

Creates a LivePagedListBuilder with required parameters.

Parameters
pagingSourceFactory: () -> PagingSource<Key, Value>

PagingSource factory providing PagingSource generations.

The returned PagingSource should invalidate itself if the snapshot is no longer valid. If a PagingSource becomes invalid, the only way to query more data is to create a new PagingSource by invoking the supplied pagingSourceFactory.

pagingSourceFactory will invoked to construct a new PagedList and PagingSource when the current