# 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)

*** ** * ** ***

Common/AllAndroid/JVMNative/C/iOSJavaScript
- android

  ```
  class LivePagedListBuilder<Key : Any, Value : Any>
  ```

*** ** * ** ***

> [!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/kotlin/androidx/paging/DataSource.Factory` and a `https://developer.android.com/reference/kotlin/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 : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html>` | Type of input valued used to load data from the `https://developer.android.com/reference/kotlin/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/kotlin/androidx/paging/PositionalDataSource`. |
| `<Value : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html>` | Item type being presented. |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/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 : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html, Value : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html> [LivePagedListBuilder](https://developer.android.com/reference/kotlin/androidx/paging/LivePagedListBuilder#LivePagedListBuilder(androidx.paging.DataSource.Factory,androidx.paging.PagedList.Config))( dataSourceFactory: https://developer.android.com/reference/kotlin/androidx/paging/DataSource.Factory<Key, Value>, config: https://developer.android.com/reference/kotlin/androidx/paging/PagedList.Config )` **This function is deprecated.** PagedList is deprecated and has been replaced by PagingData | android |
| `<Key : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html, Value : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html> [LivePagedListBuilder](https://developer.android.com/reference/kotlin/androidx/paging/LivePagedListBuilder#LivePagedListBuilder(androidx.paging.DataSource.Factory,kotlin.Int))( dataSourceFactory: https://developer.android.com/reference/kotlin/androidx/paging/DataSource.Factory<Key, Value>, pageSize: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html )` **This function is deprecated.** PagedList is deprecated and has been replaced by PagingData | android |
| `<Key : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html, Value : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html> [LivePagedListBuilder](https://developer.android.com/reference/kotlin/androidx/paging/LivePagedListBuilder#LivePagedListBuilder(kotlin.Function0,androidx.paging.PagedList.Config))( pagingSourceFactory: () -> https://developer.android.com/reference/kotlin/androidx/paging/PagingSource<Key, Value>, config: https://developer.android.com/reference/kotlin/androidx/paging/PagedList.Config )` **This function is deprecated.** PagedList is deprecated and has been replaced by PagingData | android |
| `<Key : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html, Value : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html> [LivePagedListBuilder](https://developer.android.com/reference/kotlin/androidx/paging/LivePagedListBuilder#LivePagedListBuilder(kotlin.Function0,kotlin.Int))( pagingSourceFactory: () -> https://developer.android.com/reference/kotlin/androidx/paging/PagingSource<Key, Value>, pageSize: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html )` **This function is deprecated.** PagedList is deprecated and has been replaced by PagingData | android |

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

## Public constructors

### LivePagedListBuilder

android

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

> [!CAUTION]
> **This function is deprecated.**   
> PagedList is deprecated and has been replaced by PagingData, use this instead:
>
> ```kotlin
> 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/kotlin/androidx/paging/LivePagedListBuilder` with required parameters.

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

### LivePagedListBuilder

android

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

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

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

This method is a convenience for:

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

| Parameters |
|---|---|
| `dataSourceFactory: https://developer.android.com/reference/kotlin/androidx/paging/DataSource.Factory<Key, Value>` | `https://developer.android.com/reference/kotlin/androidx/paging/DataSource.Factory` providing DataSource generations. |
| `pageSize: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | Size of pages to load. |

### LivePagedListBuilder

android

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

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

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

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

### LivePagedListBuilder

android

```
<Key : Any, Value : Any> [LivePagedListBuilder](https://developer.android.com/reference/kotlin/androidx/paging/LivePagedListBuilder#LivePagedListBuilder(kotlin.Function0,kotlin.Int))(
    pagingSourceFactory: () -> PagingSource<Key, Value>,
    pageSize: Int
)
```

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

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

This method is a convenience for:

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

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

## Public functions

### build

android 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)

```
fun [build](https://developer.android.com/reference/kotlin/androidx/paging/LivePagedListBuilder#build())(): LiveData<PagedList<Value>>
```

> [!CAUTION]
> **This function 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/kotlin/androidx/paging/PagedList` is deferred until the `https://developer.android.com/reference/kotlin/androidx/lifecycle/LiveData` is observed.

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

### setBoundaryCallback

android 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)

```
fun [setBoundaryCallback](https://developer.android.com/reference/kotlin/androidx/paging/LivePagedListBuilder#setBoundaryCallback(androidx.paging.PagedList.BoundaryCallback))(
    boundaryCallback: PagedList.BoundaryCallback<Value>?
): LivePagedListBuilder<Key, Value>
```

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

Sets a `https://developer.android.com/reference/kotlin/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/kotlin/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/kotlin/androidx/paging/PagingSource` runs out of data to provide to its `https://developer.android.com/reference/kotlin/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 |
|---|---|
| `boundaryCallback: https://developer.android.com/reference/kotlin/androidx/paging/PagedList.BoundaryCallback<Value>?` | The boundary callback for listening to PagedList load state. |

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

### setCoroutineScope

android 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)

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

> [!CAUTION]
> **This function 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/kotlin/androidx/paging/LivePagedListBuilder#setCoroutineScope(kotlinx.coroutines.CoroutineScope)` allows a `https://developer.android.com/reference/kotlin/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 |
|---|---|
| `coroutineScope: https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-scope/index.html` |   |

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

### setFetchExecutor

android 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)

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

> [!CAUTION]
> **This function 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/kotlin/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 |
|---|---|
| `fetchExecutor: https://developer.android.com/reference/java/util/concurrent/Executor.html` | `https://developer.android.com/reference/java/util/concurrent/Executor.html` for fetching data from `https://developer.android.com/reference/kotlin/androidx/paging/PagingSource`s. |

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

### setInitialLoadKey

android 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)

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

> [!CAUTION]
> **This function 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/kotlin/androidx/paging/LivePagedListBuilder<Key, Value>` | this |