# PositionalDataSource.LoadRangeCallback

Artifact: [androidx.paging:paging-common](https://developer.android.com/jetpack/androidx/releases/paging) [View Source](https://cs.android.com/search?q=file:androidx/paging/PositionalDataSource.jvmAndAndroid.kt+class:androidx.paging.PositionalDataSource.LoadRangeCallback) 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

  ```
  abstract class PositionalDataSource.LoadRangeCallback<T : Any?>
  ```

*** ** * ** ***

> [!CAUTION]
> **This class is deprecated.**   
> PositionalDataSource is deprecated and has been replaced by PagingSource, use this instead:
>
> ```kotlin
> PagingSource<Int, T>
> ```

Callback for PositionalDataSource `https://developer.android.com/reference/kotlin/androidx/paging/PositionalDataSource#loadRange(androidx.paging.PositionalDataSource.LoadRangeParams)` to return data.

A callback should be called only once, and may throw if called again.

It is always valid for a `https://developer.android.com/reference/kotlin/androidx/paging/DataSource` loading method that takes a callback to stash the callback and call it later. This enables DataSources to be fully asynchronous, and to handle temporary, recoverable error states (such as a network error that can be retried).

| Parameters |
|---|---|
| `<T : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?>` | Type of items being loaded. |

## Summary

| ### Public constructors |
|---|---|
| `<T : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?> [LoadRangeCallback](https://developer.android.com/reference/kotlin/androidx/paging/PositionalDataSource.LoadRangeCallback#LoadRangeCallback())()` **This function is deprecated.** PositionalDataSource is deprecated and has been replaced by PagingSource | android |

| ### Public functions |
|---|---|---|
| `abstract https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `[onResult](https://developer.android.com/reference/kotlin/androidx/paging/PositionalDataSource.LoadRangeCallback#onResult(kotlin.collections.List))(data: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<T>)` **This function is deprecated.** PositionalDataSource is deprecated and has been replaced by PagingSource | android |

## Public constructors

### LoadRangeCallback

android

```
<T : Any?> [LoadRangeCallback](https://developer.android.com/reference/kotlin/androidx/paging/PositionalDataSource.LoadRangeCallback#LoadRangeCallback())()
```

> [!CAUTION]
> **This function is deprecated.**   
> PositionalDataSource is deprecated and has been replaced by PagingSource, use this instead:
>
> ```kotlin
> PagingSource<Int, T>
> ```

| Parameters |
|---|---|
| `<T : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?>` | Type of items being loaded. |

## Public functions

### onResult

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

```
abstract fun [onResult](https://developer.android.com/reference/kotlin/androidx/paging/PositionalDataSource.LoadRangeCallback#onResult(kotlin.collections.List))(data: List<T>): Unit
```

> [!CAUTION]
> **This function is deprecated.**   
> PositionalDataSource is deprecated and has been replaced by PagingSource, use this instead:
>
> ```kotlin
> PagingSource<Int, T>
> ```

Called to pass loaded data from `https://developer.android.com/reference/kotlin/androidx/paging/PositionalDataSource#loadRange(androidx.paging.PositionalDataSource.LoadRangeParams)`.

| Parameters |
|---|---|
| `data: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<T>` | List of items loaded from the `https://developer.android.com/reference/kotlin/androidx/paging/DataSource`. Must be same size as requested, unless at end of list. |