# LivePagedListBuilder

Artifact: [androidx.paging:paging-runtime](https://developer.android.com/jetpack/androidx/releases/paging) [View Source](https://cs.android.com/search?q=file:androidx/paging/LivePagedListBuilder.kt+class:androidx.paging.LivePagedListBuilder) Added in [2.0.0](https://developer.android.com/jetpack/androidx/releases/paging#2.0.0) Deprecated in [3.0.0](https://developer.android.com/jetpack/androidx/releases/paging#3.0.0)

*** ** * ** ***


```
public final class LivePagedListBuilder<Key extends Object, Value extends Object>
```

<br />

*** ** * ** ***

> [!CAUTION]
> **This class is deprecated.**   
> PagedList is deprecated and has been replaced by PagingData

Builder for `LiveData<PagedList>` for Java users, given a `https://developer.android.com/reference/androidx/paging/DataSource.Factory` and a `https://developer.android.com/reference/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).

| Parameters |
|---|---|
| `<Key extends https://developer.android.com/reference/java/lang/Object.html>` | Type of input valued used to load data from the `https://developer.android.com/reference/androidx/paging/DataSource`. Must be `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` if you're using `https://developer.android.com/reference/androidx/paging/PositionalDataSource`. |
| `<Value extends https://developer.android.com/reference/java/lang/Object.html>` | Item type being presented. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/paging/package-summary#(androidx.paging.DataSource.Factory).toLiveData(androidx.paging.PagedList.Config,kotlin.Any,androidx.paging.PagedList.BoundaryCallback,java.util.concurrent.Executor)` |   |

## Summary

| ### Public constructors |
|---|
| `<Key extends https://developer.android.com/reference/java/lang/Object.html, Value extends https://developer.android.com/reference/java/lang/Object.html> [LivePagedListBuilder](https://developer.android.com/reference/androidx/paging/LivePagedListBuilder#LivePagedListBuilder(androidx.paging.DataSource.Factory,androidx.paging.PagedList.Config))( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/paging/DataSource.Factory<@https://developer.android.com/reference/androidx/annotation/NonNull Key, @https://developer.android.com/reference/androidx/annotation/NonNull Value> dataSourceFactory, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/paging/PagedList.Config config )` **This method is deprecated.** PagedList is deprecated and has been replaced by PagingData |
| `<Key extends https://developer.android.com/reference/java/lang/Object.html, Value extends https://developer.android.com/reference/java/lang/Object.html> [LivePagedListBuilder](https://developer.android.com/reference/androidx/paging/LivePagedListBuilder#LivePagedListBuilder(androidx.paging.DataSource.Factory,kotlin.Int))( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/paging/DataSource.Factory<@https://developer.android.com/reference/androidx/annotation/NonNull Key, @https://developer.android.com/reference/androidx/annotation/NonNull Value> dataSourceFactory, int pageSize )` **This method is deprecated.** PagedList is deprecated and has been replaced by PagingData |
| `<Key extends https://developer.android.com/reference/java/lang/Object.html, Value extends https://developer.android.com/reference/java/lang/Object.html> [LivePagedListBuilder](https://developer.android.com/reference/androidx/paging/LivePagedListBuilder#LivePagedListBuilder(kotlin.Function0,androidx.paging.PagedList.Config))( @https://developer.android.com/reference/androidx/annotation/NonNull Function0<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/paging/PagingSource<@https://developer.android.com/reference/androidx/annotation/NonNull Key, @https://developer.android.com/reference/androidx/annotation/NonNull Value>> pagingSourceFactory, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/paging/PagedList.Config config )` **This method is deprecated.** PagedList is deprecated and has been replaced by PagingData |
| `<Key extends https://developer.android.com/reference/java/lang/Object.html, Value extends https://developer.android.com/reference/java/lang/Object.html> [LivePagedListBuilder](https://developer.android.com/reference/androidx/paging/LivePagedListBuilder#LivePagedListBuilder(kotlin.Function0,kotlin.Int))( @https://developer.android.com/reference/androidx/annotation/NonNull Function0<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/paging/PagingSource<@https://developer.android.com/reference/androidx/annotation/NonNull Key, @https://developer.android.com/reference/androidx/annotation/NonNull Value>> pagingSourceFactory, int pageSize )` **This method is deprecated.** PagedList is deprecated and has been replaced by PagingData |

| ### Public methods |
|---|---|
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/lifecycle/LiveData<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/paging/PagedList<@https://developer.android.com/reference/androidx/annotation/NonNull Value>>` | `[build](https://developer.android.com/reference/androidx/paging/LivePagedListBuilder#build())()` **This method is deprecated.** PagedList is deprecated and has been replaced by PagingData |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/paging/LivePagedListBuilder<@https://developer.android.com/reference/androidx/annotation/NonNull Key, @https://developer.android.com/reference/androidx/annotation/NonNull Value>` | `[setBoundaryCallback](https://developer.android.com/reference/androidx/paging/LivePagedListBuilder#setBoundaryCallback(androidx.paging.PagedList.BoundaryCallback))( https://developer.android.com/reference/androidx/paging/PagedList.BoundaryCallback<@https://developer.android.com/reference/androidx/annotation/NonNull Value> boundaryCallback )` **This method is deprecated.** PagedList is deprecated and has been replaced by PagingData |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/paging/LivePagedListBuilder<@https://developer.android.com/reference/androidx/annotation/NonNull Key, @https://developer.android.com/reference/androidx/annotation/NonNull Value>` | `[setCoroutineScope](https://developer.android.com/reference/androidx/paging/LivePagedListBuilder#setCoroutineScope(kotlinx.coroutines.CoroutineScope))(@https://developer.android.com/reference/androidx/annotation/NonNull https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-scope/index.html coroutineScope)` **This method is deprecated.** PagedList is deprecated and has been replaced by PagingData |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/paging/LivePagedListBuilder<@https://developer.android.com/reference/androidx/annotation/NonNull Key, @https://developer.android.com/reference/androidx/annotation/NonNull Value>` | `[setFetchExecutor](https://developer.android.com/reference/androidx/paging/LivePagedListBuilder#setFetchExecutor(java.util.concurrent.Executor))(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/concurrent/Executor.html fetchExecutor)` **This method is deprecated.** PagedList is deprecated and has been replaced by PagingData |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/paging/LivePagedListBuilder<@https://developer.android.com/reference/androidx/annotation/NonNull Key, @https://developer.android.com/reference/androidx/annotation/NonNull Value>` | `[setInitialLoadKey](https://developer.android.com/reference/androidx/paging/LivePagedListBuilder#setInitialLoadKey(kotlin.Any))(Key key)` **This method is deprecated.** PagedList is deprecated and has been replaced by PagingData |

## Public constructors

### LivePagedListBuilder

```
public <Key extends Object, Value extends Object> [LivePagedListBuilder](https://developer.android.com/reference/androidx/paging/LivePagedListBuilder#LivePagedListBuilder(androidx.paging.DataSource.Factory,androidx.paging.PagedList.Config))(
    @NonNull DataSource.Factory<@NonNull Key, @NonNull Value> dataSourceFactory,
    @NonNull PagedList.Config config
)
```

> [!CAUTION]
> **This method is deprecated.**   
> PagedList is deprecated and has been replaced by PagingData, use this instead:
>
> ```
> Pager(
>                 PagingConfig(
>                     config.pageSize,
>                     config.prefetchDistance,
>                     config.enablePlaceholders,
>                     config.initialLoadSizeHint,
>                     config.maxSize
>                 ),
>                 initialLoadKey,
>                 dataSourceFactory.asPagingSourceFactory(Dispatchers.IO)
>             ).liveData
> ```

Creates a `https://developer.android.com/reference/androidx/paging/LivePagedListBuilder` with required parameters.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/paging/DataSource.Factory<@https://developer.android.com/reference/androidx/annotation/NonNull Key, @https://developer.android.com/reference/androidx/annotation/NonNull Value> dataSourceFactory` | `https://developer.android.com/reference/androidx/paging/DataSource` factory providing DataSource generations. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/paging/PagedList.Config config` | Paging configuration. |

### LivePagedListBuilder

```
public <Key extends Object, Value extends Object> [LivePagedListBuilder](https://developer.android.com/reference/androidx/paging/LivePagedListBuilder#LivePagedListBuilder(androidx.paging.DataSource.Factory,kotlin.Int))(
    @NonNull DataSource.Factory<@NonNull Key, @NonNull Value> dataSourceFactory,
    int pageSize
)
```

> [!CAUTION]
> **This method is deprecated.**   
> PagedList is deprecated and has been replaced by PagingData, use this instead:
>
> ```
> Pager(
>                 PagingConfig(pageSize),
>                 initialLoadKey,
>                 dataSourceFactory.asPagingSourceFactory(Dispatchers.IO)
>             ).liveData
> ```

Creates a `https://developer.android.com/reference/androidx/paging/LivePagedListBuilder` with required parameters.

This method is a convenience for:

```
LivePagedListBuilder(dataSourceFactory,
        new PagedList.Config.Builder().setPageSize(pageSize).build())
```

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/paging/DataSource.Factory<@https://developer.android.com/reference/androidx/annotation/NonNull Key, @https://developer.android.com/reference/androidx/annotation/NonNull Value> dataSourceFactory` | `https://developer.android.com/reference/androidx/paging/DataSource.Factory` providing DataSource generations. |
| `int pageSize` | Size of pages to load. |

### LivePagedListBuilder

```
public <Key extends Object, Value extends Object> [LivePagedListBuilder](https://developer.android.com/reference/androidx/paging/LivePagedListBuilder#LivePagedListBuilder(kotlin.Function0,androidx.paging.PagedList.Config))(
    @NonNull Function0<@NonNull PagingSource<@NonNull Key, @NonNull Value>> pagingSourceFactory,
    @NonNull PagedList.Config config
)
```

> [!CAUTION]
> **This method is deprecated.**   
> PagedList is deprecated and has been replaced by PagingData, use this instead:
>
> ```
> Pager(
>                 PagingConfig(
>                     config.pageSize,
>                     config.prefetchDistance,
>                     config.enablePlaceholders,
>                     config.initialLoadSizeHint,
>                     config.maxSize
>                 ),
>                 initialLoadKey,
>                 this
>             ).liveData
> ```

Creates a `https://developer.android.com/reference/androidx/paging/LivePagedListBuilder` with required parameters.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull Function0<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/paging/PagingSource<@https://developer.android.com/reference/androidx/annotation/NonNull Key, @https://developer.android.com/reference/androidx/annotation/NonNull Value>> pagingSourceFactory` | `https://developer.android.com/reference/androidx/paging/PagingSource` factory providing `https://developer.android.com/reference/androidx/paging/PagingSource` generations. The returned `https://developer.android.com/reference/androidx/paging/PagingSource` should invalidate itself if the snapshot is no longer valid. If a `https://developer.android.com/reference/androidx/paging/PagingSource` becomes invalid, the only way to query more data is to create a new `https://developer.android.com/reference/androidx/paging/PagingSource` by invoking the supplied `https://developer.android.com/reference/androidx/paging/LivePagedListBuilder#(kotlin.Function0,androidx.paging.PagedList.Config)`. `https://developer.android.com/reference/androidx/paging/LivePagedListBuilder#(kotlin.Function0,androidx.paging.PagedList.Config)` will invoked to construct a new `https://developer.android.com/reference/androidx/paging/PagedList` and `https://developer.android.com/reference/androidx/paging/PagingSource` when the current `https://developer.android.com/reference/androidx/paging/PagingSource` is invalidated, and pass the new `https://developer.android.com/reference/androidx/paging/PagedList` through the `LiveData<PagedList>` to observers. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/paging/PagedList.Config config` | Paging configuration. |

### LivePagedListBuilder

```
public <Key extends Object, Value extends Object> [LivePagedListBuilder](https://developer.android.com/reference/androidx/paging/LivePagedListBuilder#LivePagedListBuilder(kotlin.Function0,kotlin.Int))(
    @NonNull Function0<@NonNull PagingSource<@NonNull Key, @NonNull Value>> pagingSourceFactory,
    int pageSize
)
```

> [!CAUTION]
> **This method is deprecated.**   
> PagedList is deprecated and has been replaced by PagingData, use this instead:
>
> ```
> Pager(
>                 PagingConfig(pageSize),
>                 initialLoadKey,
>                 this
>             ).liveData
> ```

Creates a `https://developer.android.com/reference/androidx/paging/LivePagedListBuilder` with required parameters.

This method is a convenience for:

```
LivePagedListBuilder(pagingSourceFactory,
        new PagedList.Config.Builder().setPageSize(pageSize).build())
```

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull Function0<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/paging/PagingSource<@https://developer.android.com/reference/androidx/annotation/NonNull Key, @https://developer.android.com/reference/androidx/annotation/NonNull Value>> pagingSourceFactory` | `https://developer.android.com/reference/androidx/paging/PagingSource` factory providing `https://developer.android.com/reference/androidx/paging/PagingSource` generations. The returned `https://developer.android.com/reference/androidx/paging/PagingSource` should invalidate itself if the snapshot is no longer valid. If a `https://developer.android.com/reference/androidx/paging/PagingSource` becomes invalid, the only way to query more data is to create a new `https://developer.android.com/reference/androidx/paging/PagingSource` by invoking the supplied `https://developer.android.com/reference/androidx/paging/LivePagedListBuilder#(kotlin.Function0,kotlin.Int)`. `https://developer.android.com/reference/androidx/paging/LivePagedListBuilder#(kotlin.Function0,kotlin.Int)` will invoked to construct a new `https://developer.android.com/reference/androidx/paging/PagedList` and `https://developer.android.com/reference/androidx/paging/PagingSource` when the current `https://developer.android.com/reference/androidx/paging/PagingSource` is invalidated, and pass the new `https://developer.android.com/reference/androidx/paging/PagedList` through the `LiveData<PagedList>` to observers. |
| `int pageSize` | Size of pages to load. |

## Public methods

### build

Added in [2.0.0](https://developer.android.com/jetpack/androidx/releases/paging#2.0.0) Deprecated in [3.0.0](https://developer.android.com/jetpack/androidx/releases/paging#3.0.0)

```
public final @NonNull LiveData<@NonNull PagedList<@NonNull Value>> [build](https://developer.android.com/reference/androidx/paging/LivePagedListBuilder#build())()
```

> [!CAUTION]
> **This method is deprecated.**   
> PagedList is deprecated and has been replaced by PagingData

Constructs the `LiveData<PagedList>`.

No work (such as loading) is done immediately, the creation of the first `https://developer.android.com/reference/androidx/paging/PagedList` is deferred until the `https://developer.android.com/reference/androidx/lifecycle/LiveData` is observed.

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/lifecycle/LiveData<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/paging/PagedList<@https://developer.android.com/reference/androidx/annotation/NonNull Value>>` | The `https://developer.android.com/reference/androidx/lifecycle/LiveData` of `https://developer.android.com/reference/androidx/paging/PagedList`s |

### setBoundaryCallback

Added in [2.0.0](https://developer.android.com/jetpack/androidx/releases/paging#2.0.0) Deprecated in [3.0.0](https://developer.android.com/jetpack/androidx/releases/paging#3.0.0)

```
public final @NonNull LivePagedListBuilder<@NonNull Key, @NonNull Value> [setBoundaryCallback](https://developer.android.com/reference/androidx/paging/LivePagedListBuilder#setBoundaryCallback(androidx.paging.PagedList.BoundaryCallback))(
    PagedList.BoundaryCallback<@NonNull Value> boundaryCallback
)
```

> [!CAUTION]
> **This method is deprecated.**   
> PagedList is deprecated and has been replaced by PagingData

Sets a `https://developer.android.com/reference/androidx/paging/PagedList.BoundaryCallback` on each PagedList created, typically used to load additional data from network when paging from local storage.

Pass a `https://developer.android.com/reference/androidx/paging/PagedList.BoundaryCallback` to listen to when the PagedList runs out of data to load. If this method is not called, or `null` is passed, you will not be notified when each `https://developer.android.com/reference/androidx/paging/PagingSource` runs out of data to provide to its `https://developer.android.com/reference/androidx/paging/PagedList`.

If you are paging from a DataSource.Factory backed by local storage, you can set a BoundaryCallback to know when there is no more information to page from local storage. This is useful to page from the network when local storage is a cache of network data.

Note that when using a BoundaryCallback with a `LiveData<PagedList>`, method calls on the callback may be dispatched multiple times - one for each PagedList/DataSource pair. If loading network data from a BoundaryCallback, you should prevent multiple dispatches of the same method from triggering multiple simultaneous network loads.

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/paging/PagedList.BoundaryCallback<@https://developer.android.com/reference/androidx/annotation/NonNull Value> boundaryCallback` | The boundary callback for listening to PagedList load state. |

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/paging/LivePagedListBuilder<@https://developer.android.com/reference/androidx/annotation/NonNull Key, @https://developer.android.com/reference/androidx/annotation/NonNull Value>` | this |

### setCoroutineScope

Added in [3.0.0](https://developer.android.com/jetpack/androidx/releases/paging#3.0.0) Deprecated in [3.0.0](https://developer.android.com/jetpack/androidx/releases/paging#3.0.0)

```
public final @NonNull LivePagedListBuilder<@NonNull Key, @NonNull Value> [setCoroutineScope](https://developer.android.com/reference/androidx/paging/LivePagedListBuilder#setCoroutineScope(kotlinx.coroutines.CoroutineScope))(@NonNull CoroutineScope coroutineScope)
```

> [!CAUTION]
> **This method is deprecated.**   
> PagedList is deprecated and has been replaced by PagingData

Set the `https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-scope/index.html` that page loads should be launched within. The set `https://developer.android.com/reference/androidx/paging/LivePagedListBuilder#setCoroutineScope(kotlinx.coroutines.CoroutineScope)` allows a `https://developer.android.com/reference/androidx/paging/PagingSource` to cancel running load operations when the results are no longer needed - for example, when the containing activity is destroyed.

Defaults to `https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-global-scope/index.html`.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-scope/index.html coroutineScope` |   |

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/paging/LivePagedListBuilder<@https://developer.android.com/reference/androidx/annotation/NonNull Key, @https://developer.android.com/reference/androidx/annotation/NonNull Value>` | this |

### setFetchExecutor

Added in [2.0.0](https://developer.android.com/jetpack/androidx/releases/paging#2.0.0) Deprecated in [3.0.0](https://developer.android.com/jetpack/androidx/releases/paging#3.0.0)

```
public final @NonNull LivePagedListBuilder<@NonNull Key, @NonNull Value> [setFetchExecutor](https://developer.android.com/reference/androidx/paging/LivePagedListBuilder#setFetchExecutor(java.util.concurrent.Executor))(@NonNull Executor fetchExecutor)
```

> [!CAUTION]
> **This method is deprecated.**   
> PagedList is deprecated and has been replaced by PagingData

Sets `https://developer.android.com/reference/java/util/concurrent/Executor.html` used for background fetching of `https://developer.android.com/reference/androidx/paging/PagedList`s, and the pages within.

The library will wrap this as a `https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-dispatcher/index.html`.

If not set, defaults to a `https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-executor-coroutine-dispatcher/index.html` backed by .

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/concurrent/Executor.html fetchExecutor` | `https://developer.android.com/reference/java/util/concurrent/Executor.html` for fetching data from `https://developer.android.com/reference/androidx/paging/PagingSource`s. |

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/paging/LivePagedListBuilder<@https://developer.android.com/reference/androidx/annotation/NonNull Key, @https://developer.android.com/reference/androidx/annotation/NonNull Value>` | this |

### setInitialLoadKey

Added in [2.0.0](https://developer.android.com/jetpack/androidx/releases/paging#2.0.0) Deprecated in [3.0.0](https://developer.android.com/jetpack/androidx/releases/paging#3.0.0)

```
public final @NonNull LivePagedListBuilder<@NonNull Key, @NonNull Value> [setInitialLoadKey](https://developer.android.com/reference/androidx/paging/LivePagedListBuilder#setInitialLoadKey(kotlin.Any))(Key key)
```

> [!CAUTION]
> **This method is deprecated.**   
> PagedList is deprecated and has been replaced by PagingData

First loading key passed to the first PagedList/DataSource.

When a new PagedList/DataSource pair is created after the first, it acquires a load key from the previous generation so that data is loaded around the position already being observed.

| Parameters |
|---|---|
| `Key key` | Initial load key passed to the first PagedList/DataSource. |

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/paging/LivePagedListBuilder<@https://developer.android.com/reference/androidx/annotation/NonNull Key, @https://developer.android.com/reference/androidx/annotation/NonNull Value>` | this |