blob: 120b9bc377500619f3a702d57abdd49afdfad45a [file] [log] [blame]
<html devsite="true">
<head>
<title>ListenableFutureRemoteMediator</title>
{% setvar book_path %}/reference/kotlin/androidx/_book.yaml{% endsetvar %}
{% include "_shared/_reference-head-tags.html" %}
</head>
<body>
<div id="metadata-info-block"></div>
<h1>ListenableFutureRemoteMediator</h1>
<p>
<pre>@<a href="/reference/kotlin/androidx/paging/ExperimentalPagingApi.html">ExperimentalPagingApi</a><br>abstract class <a href="/reference/kotlin/androidx/paging/ListenableFutureRemoteMediator.html">ListenableFutureRemoteMediator</a>&lt;Key&nbsp;:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html">Any</a>,&nbsp;Value&nbsp;:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html">Any</a>&gt; : <a href="/reference/kotlin/androidx/paging/RemoteMediator.html">RemoteMediator</a></pre>
</p>
<div class="devsite-table-wrapper">
<table class="jd-inheritance-table">
<tbody>
<tr>
<td colspan="3"><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html">kotlin.Any</a></td>
</tr>
<tr>
<td class="jd-inheritance-space">&nbsp;&nbsp;&nbsp;↳</td>
<td colspan="2"><a href="/reference/kotlin/androidx/paging/RemoteMediator.html">androidx.paging.RemoteMediator</a></td>
</tr>
<tr>
<td>&nbsp;</td>
<td class="jd-inheritance-space">&nbsp;&nbsp;&nbsp;↳</td>
<td colspan="1"><a href="/reference/kotlin/androidx/paging/ListenableFutureRemoteMediator.html">androidx.paging.ListenableFutureRemoteMediator</a></td>
</tr>
</tbody>
</table>
</div>
<hr>
<p><code><a href="https://guava.dev/releases/18.0/api/docs/package-list/com/google/common/util/concurrent/ListenableFuture.html">ListenableFuture</a></code>-based compatibility wrapper around <code><a href="/reference/kotlin/androidx/paging/RemoteMediator.html">RemoteMediator</a></code>'s suspending APIs.</p>
<h2>Summary</h2>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="100%"><h3>Public constructors</h3></th>
</tr>
</thead>
<tbody class="list">
<tr>
<td>
<div><code>&lt;Key&nbsp;:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html">Any</a>,&nbsp;Value&nbsp;:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html">Any</a>&gt; <a href="/reference/kotlin/androidx/paging/ListenableFutureRemoteMediator.html#ListenableFutureRemoteMediator()">ListenableFutureRemoteMediator</a>()</code></div>
</td>
</tr>
</tbody>
</table>
</div>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="100%"><h3>Public functions</h3></th>
</tr>
</thead>
<tbody class="list">
<tr>
<td width="40%"><code>final&nbsp;suspend <a href="/reference/kotlin/androidx/paging/RemoteMediator.InitializeAction.html">RemoteMediator.InitializeAction</a></code></td>
<td>
<div><code><a href="/reference/kotlin/androidx/paging/ListenableFutureRemoteMediator.html#initialize()">initialize</a>()</code></div>
<p>Callback fired during initialization of a <code><a href="/reference/kotlin/androidx/paging/PagingData.html">PagingData</a></code> stream, before initial load.</p>
</td>
</tr>
<tr>
<td width="40%"><code>open <a href="https://guava.dev/releases/18.0/api/docs/package-list/com/google/common/util/concurrent/ListenableFuture.html">ListenableFuture</a>&lt;<a href="/reference/kotlin/androidx/paging/RemoteMediator.InitializeAction.html">RemoteMediator.InitializeAction</a>&gt;</code></td>
<td>
<div><code><a href="/reference/kotlin/androidx/paging/ListenableFutureRemoteMediator.html#initializeFuture()">initializeFuture</a>()</code></div>
<p>Callback fired during initialization of a <code><a href="/reference/kotlin/androidx/paging/PagingData.html">PagingData</a></code> stream, before initial load.</p>
</td>
</tr>
<tr>
<td width="40%"><code>final&nbsp;suspend <a href="/reference/kotlin/androidx/paging/RemoteMediator.MediatorResult.html">RemoteMediator.MediatorResult</a></code></td>
<td>
<div><code><a href="/reference/kotlin/androidx/paging/ListenableFutureRemoteMediator.html#load(androidx.paging.LoadType,androidx.paging.PagingState)">load</a>(loadType:&nbsp;<a href="/reference/kotlin/androidx/paging/LoadType.html">LoadType</a>,&nbsp;state:&nbsp;<a href="/reference/kotlin/androidx/paging/PagingState.html">PagingState</a>&lt;Key,&nbsp;Value&gt;)</code></div>
<p>Callback triggered when Paging needs to request more data from a remote source due to any of the following events:</p>
</td>
</tr>
<tr>
<td width="40%"><code>abstract <a href="https://guava.dev/releases/18.0/api/docs/package-list/com/google/common/util/concurrent/ListenableFuture.html">ListenableFuture</a>&lt;<a href="/reference/kotlin/androidx/paging/RemoteMediator.MediatorResult.html">RemoteMediator.MediatorResult</a>&gt;</code></td>
<td>
<div><code><a href="/reference/kotlin/androidx/paging/ListenableFutureRemoteMediator.html#loadFuture(androidx.paging.LoadType,androidx.paging.PagingState)">loadFuture</a>(loadType:&nbsp;<a href="/reference/kotlin/androidx/paging/LoadType.html">LoadType</a>,&nbsp;state:&nbsp;<a href="/reference/kotlin/androidx/paging/PagingState.html">PagingState</a>&lt;Key,&nbsp;Value&gt;)</code></div>
<p>Implement this method to load additional remote data, which will then be stored for the <code><a href="/reference/kotlin/androidx/paging/PagingSource.html">PagingSource</a></code> to access.</p>
</td>
</tr>
</tbody>
</table>
</div>
<h2>Public constructors</h2>
<div><a name="ListenableFutureRemoteMediator--"></a><a name="listenablefutureremotemediator"></a>
<h3 class="api-name" id="ListenableFutureRemoteMediator()">ListenableFutureRemoteMediator</h3>
<pre class="api-signature no-pretty-print">&lt;Key&nbsp;:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html">Any</a>,&nbsp;Value&nbsp;:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html">Any</a>&gt; <a href="/reference/kotlin/androidx/paging/ListenableFutureRemoteMediator.html#ListenableFutureRemoteMediator()">ListenableFutureRemoteMediator</a>()</pre>
</div>
<h2>Public functions</h2>
<div><a name="initialize--"></a><a name="initialize"></a>
<h3 class="api-name" id="initialize()">initialize</h3>
<pre class="api-signature no-pretty-print">final&nbsp;suspend&nbsp;fun&nbsp;<a href="/reference/kotlin/androidx/paging/ListenableFutureRemoteMediator.html#initialize()">initialize</a>():&nbsp;<a href="/reference/kotlin/androidx/paging/RemoteMediator.InitializeAction.html">RemoteMediator.InitializeAction</a></pre>
<p>Callback fired during initialization of a <code><a href="/reference/kotlin/androidx/paging/PagingData.html">PagingData</a></code> stream, before initial load.</p>
<p>This function runs to completion before any loading is performed.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="100%">Returns</th>
</tr>
</thead>
<tbody class="list">
<tr>
<td width="40%"><code><a href="/reference/kotlin/androidx/paging/RemoteMediator.InitializeAction.html">RemoteMediator.InitializeAction</a></code></td>
<td>
<p>InitializeAction used to control whether <code><a href="/reference/kotlin/androidx/paging/ListenableFutureRemoteMediator.html#load(androidx.paging.LoadType,androidx.paging.PagingState)">load</a></code> with load type <code><a href="/reference/kotlin/androidx/paging/LoadType.html#REFRESH">REFRESH</a></code> will be immediately dispatched when the first <code><a href="/reference/kotlin/androidx/paging/PagingData.html">PagingData</a></code> is submitted:</p>
<ul>
<li>
<p><code><a href="/reference/kotlin/androidx/paging/RemoteMediator.InitializeAction.html#LAUNCH_INITIAL_REFRESH">LAUNCH_INITIAL_REFRESH</a></code> to immediately dispatch <code><a href="/reference/kotlin/androidx/paging/ListenableFutureRemoteMediator.html#load(androidx.paging.LoadType,androidx.paging.PagingState)">load</a></code> asynchronously with load type <code><a href="/reference/kotlin/androidx/paging/LoadType.html#REFRESH">REFRESH</a></code>, to update paginated content when the stream is initialized. Note: This also prevents <code><a href="/reference/kotlin/androidx/paging/RemoteMediator.html">RemoteMediator</a></code> from triggering <code><a href="/reference/kotlin/androidx/paging/LoadType.html#PREPEND">PREPEND</a></code> or <code><a href="/reference/kotlin/androidx/paging/LoadType.html#APPEND">APPEND</a></code> until <code><a href="/reference/kotlin/androidx/paging/LoadType.html#REFRESH">REFRESH</a></code> succeeds.</p>
</li>
<li>
<p>SKIP_INITIAL_REFRESH to wait for a refresh request from the UI before dispatching <code><a href="/reference/kotlin/androidx/paging/ListenableFutureRemoteMediator.html#load(androidx.paging.LoadType,androidx.paging.PagingState)">load</a></code> asynchronously with load type <code><a href="/reference/kotlin/androidx/paging/LoadType.html#REFRESH">REFRESH</a></code>.</p>
</li>
</ul>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="initializeFuture--"></a><a name="initializefuture"></a>
<h3 class="api-name" id="initializeFuture()">initializeFuture</h3>
<pre class="api-signature no-pretty-print">open&nbsp;fun&nbsp;<a href="/reference/kotlin/androidx/paging/ListenableFutureRemoteMediator.html#initializeFuture()">initializeFuture</a>():&nbsp;<a href="https://guava.dev/releases/18.0/api/docs/package-list/com/google/common/util/concurrent/ListenableFuture.html">ListenableFuture</a>&lt;<a href="/reference/kotlin/androidx/paging/RemoteMediator.InitializeAction.html">RemoteMediator.InitializeAction</a>&gt;</pre>
<p>Callback fired during initialization of a <code><a href="/reference/kotlin/androidx/paging/PagingData.html">PagingData</a></code> stream, before initial load.</p>
<p>This function runs to completion before any loading is performed.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="100%">Returns</th>
</tr>
</thead>
<tbody class="list">
<tr>
<td width="40%"><code><a href="https://guava.dev/releases/18.0/api/docs/package-list/com/google/common/util/concurrent/ListenableFuture.html">ListenableFuture</a>&lt;<a href="/reference/kotlin/androidx/paging/RemoteMediator.InitializeAction.html">RemoteMediator.InitializeAction</a>&gt;</code></td>
<td>
<p>InitializeAction indicating the action to take after initialization:</p>
<ul>
<li>
<p><code><a href="/reference/kotlin/androidx/paging/RemoteMediator.InitializeAction.html#LAUNCH_INITIAL_REFRESH">LAUNCH_INITIAL_REFRESH</a></code> to immediately dispatch a <code><a href="/reference/kotlin/androidx/paging/ListenableFutureRemoteMediator.html#load(androidx.paging.LoadType,androidx.paging.PagingState)">load</a></code> asynchronously with load type <code><a href="/reference/kotlin/androidx/paging/LoadType.html#REFRESH">LoadType.REFRESH</a></code>, to update paginated content when the stream is initialized. Note: This also prevents <code><a href="/reference/kotlin/androidx/paging/RemoteMediator.html">RemoteMediator</a></code> from triggering <code><a href="/reference/kotlin/androidx/paging/LoadType.html#PREPEND">PREPEND</a></code> or <code><a href="/reference/kotlin/androidx/paging/LoadType.html#APPEND">APPEND</a></code> until <code><a href="/reference/kotlin/androidx/paging/LoadType.html#REFRESH">REFRESH</a></code> succeeds.</p>
</li>
<li>
<p>InitializeAction.SKIP_INITIAL_REFRESH to wait for a refresh request from the UI before dispatching a <code><a href="/reference/kotlin/androidx/paging/ListenableFutureRemoteMediator.html#load(androidx.paging.LoadType,androidx.paging.PagingState)">load</a></code> with load type <code><a href="/reference/kotlin/androidx/paging/LoadType.html#REFRESH">LoadType.REFRESH</a></code>.</p>
</li>
</ul>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="load(androidx.paging.LoadType, androidx.paging.PagingState)"></a><a name="load-androidx.paging.LoadType-androidx.paging.PagingState-"></a><a name="load"></a>
<h3 class="api-name" id="load(androidx.paging.LoadType,androidx.paging.PagingState)">load</h3>
<pre class="api-signature no-pretty-print">final&nbsp;suspend&nbsp;fun&nbsp;<a href="/reference/kotlin/androidx/paging/ListenableFutureRemoteMediator.html#load(androidx.paging.LoadType,androidx.paging.PagingState)">load</a>(loadType:&nbsp;<a href="/reference/kotlin/androidx/paging/LoadType.html">LoadType</a>,&nbsp;state:&nbsp;<a href="/reference/kotlin/androidx/paging/PagingState.html">PagingState</a>&lt;Key,&nbsp;Value&gt;):&nbsp;<a href="/reference/kotlin/androidx/paging/RemoteMediator.MediatorResult.html">RemoteMediator.MediatorResult</a></pre>
<p>Callback triggered when Paging needs to request more data from a remote source due to any of the following events:</p>
<ul>
<li>
<p>Stream initialization if <code><a href="/reference/kotlin/androidx/paging/ListenableFutureRemoteMediator.html#initialize()">initialize</a></code> returns <code><a href="/reference/kotlin/androidx/paging/RemoteMediator.InitializeAction.html#LAUNCH_INITIAL_REFRESH">LAUNCH_INITIAL_REFRESH</a></code></p>
</li>
<li>
<p><code><a href="/reference/kotlin/androidx/paging/LoadType.html#REFRESH">REFRESH</a></code> signal driven from UI</p>
</li>
<li>
<p><code><a href="/reference/kotlin/androidx/paging/PagingSource.html">PagingSource</a></code> returns a LoadResult which signals a boundary condition, i.e., the most recent LoadResult.Page in the <code><a href="/reference/kotlin/androidx/paging/LoadType.html#PREPEND">PREPEND</a></code> or <code><a href="/reference/kotlin/androidx/paging/LoadType.html#APPEND">APPEND</a></code> direction has LoadResult.Page.prevKey or LoadResult.Page.nextKey set to <code>null</code> respectively.</p>
</li>
</ul>
<p>It is the responsibility of this method to update the backing dataset and trigger <code><a href="/reference/kotlin/androidx/paging/PagingSource.html#invalidate()">PagingSource.invalidate</a></code> to allow <code><a href="/reference/kotlin/androidx/paging/PagingDataAdapter.html">androidx.paging.PagingDataAdapter</a></code> to pick up new items found by <code><a href="/reference/kotlin/androidx/paging/ListenableFutureRemoteMediator.html#load(androidx.paging.LoadType,androidx.paging.PagingState)">load</a></code>.</p>
<p>The runtime and result of this method defines the remote <code><a href="/reference/kotlin/androidx/paging/LoadState.html">LoadState</a></code> behavior sent to the UI via <code><a href="/reference/kotlin/androidx/paging/CombinedLoadStates.html">CombinedLoadStates</a></code>.</p>
<p>This method is never called concurrently <em>unless</em> <code><a href="/reference/kotlin/androidx/paging/Pager.html#flow()">Pager.flow</a></code> has multiple collectors. Note that Paging might cancel calls to this function if it is currently executing a <code><a href="/reference/kotlin/androidx/paging/LoadType.html#PREPEND">PREPEND</a></code> or <code><a href="/reference/kotlin/androidx/paging/LoadType.html#APPEND">APPEND</a></code> and a <code><a href="/reference/kotlin/androidx/paging/LoadType.html#REFRESH">REFRESH</a></code> is requested. In that case, <code><a href="/reference/kotlin/androidx/paging/LoadType.html#REFRESH">REFRESH</a></code> has higher priority and will be executed after the previous call is cancelled. If the <code><a href="/reference/kotlin/androidx/paging/ListenableFutureRemoteMediator.html#load(androidx.paging.LoadType,androidx.paging.PagingState)">load</a></code> call with <code><a href="/reference/kotlin/androidx/paging/LoadType.html#REFRESH">REFRESH</a></code> returns an error, Paging will call <code><a href="/reference/kotlin/androidx/paging/ListenableFutureRemoteMediator.html#load(androidx.paging.LoadType,androidx.paging.PagingState)">load</a></code> with the previously cancelled <code><a href="/reference/kotlin/androidx/paging/LoadType.html#APPEND">APPEND</a></code> or <code><a href="/reference/kotlin/androidx/paging/LoadType.html#PREPEND">PREPEND</a></code> request. If <code><a href="/reference/kotlin/androidx/paging/LoadType.html#REFRESH">REFRESH</a></code> succeeds, it won't make the <code><a href="/reference/kotlin/androidx/paging/LoadType.html#APPEND">APPEND</a></code> or <code><a href="/reference/kotlin/androidx/paging/LoadType.html#PREPEND">PREPEND</a></code> requests unless they are necessary again after the <code><a href="/reference/kotlin/androidx/paging/LoadType.html#REFRESH">REFRESH</a></code> is applied to the UI.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="100%">Parameters</th>
</tr>
</thead>
<tbody class="list">
<tr>
<td width="40%"><code>loadType:&nbsp;<a href="/reference/kotlin/androidx/paging/LoadType.html">LoadType</a></code></td>
<td>
<p><code><a href="/reference/kotlin/androidx/paging/LoadType.html">LoadType</a></code> of the condition which triggered this callback.</p>
<ul>
<li>
<p><code><a href="/reference/kotlin/androidx/paging/LoadType.html#PREPEND">PREPEND</a></code> indicates the end of pagination in the <code><a href="/reference/kotlin/androidx/paging/LoadType.html#PREPEND">PREPEND</a></code> direction was reached. This occurs when <code><a href="/reference/kotlin/androidx/paging/PagingSource.html#load(androidx.paging.PagingSource.LoadParams)">PagingSource.load</a></code> returns a LoadResult.Page with LoadResult.Page.prevKey == <code>null</code>.</p>
</li>
<li>
<p><code><a href="/reference/kotlin/androidx/paging/LoadType.html#APPEND">APPEND</a></code> indicates the end of pagination in the <code><a href="/reference/kotlin/androidx/paging/LoadType.html#APPEND">APPEND</a></code> direction was reached. This occurs when <code><a href="/reference/kotlin/androidx/paging/PagingSource.html#load(androidx.paging.PagingSource.LoadParams)">PagingSource.load</a></code> returns a LoadResult.Page with LoadResult.Page.nextKey == <code>null</code>.</p>
</li>
<li>
<p><code><a href="/reference/kotlin/androidx/paging/LoadType.html#REFRESH">REFRESH</a></code> indicates this method was triggered due to a requested refresh. Generally, this means that a request to load remote data and <b>replace</b> all local data was made. This can happen when:</p>
</li>
<ul>
<li>
<p>Stream initialization if <code><a href="/reference/kotlin/androidx/paging/ListenableFutureRemoteMediator.html#initialize()">initialize</a></code> returns <code><a href="/reference/kotlin/androidx/paging/RemoteMediator.InitializeAction.html#LAUNCH_INITIAL_REFRESH">LAUNCH_INITIAL_REFRESH</a></code></p>
</li>
<li>
<p>An explicit call to refresh driven by the UI</p>
</li>
</ul>
</ul>
</td>
</tr>
<tr>
<td width="40%"><code>state:&nbsp;<a href="/reference/kotlin/androidx/paging/PagingState.html">PagingState</a>&lt;Key,&nbsp;Value&gt;</code></td>
<td>
<p>A copy of the state including the list of pages currently held in memory of the currently presented <code><a href="/reference/kotlin/androidx/paging/PagingData.html">PagingData</a></code> at the time of starting the load. E.g. for load(loadType = APPEND), you can use the page or item at the end as input for what to load from the network.</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="100%">Returns</th>
</tr>
</thead>
<tbody class="list">
<tr>
<td width="40%"><code><a href="/reference/kotlin/androidx/paging/RemoteMediator.MediatorResult.html">RemoteMediator.MediatorResult</a></code></td>
<td>
<p>MediatorResult signifying what <code><a href="/reference/kotlin/androidx/paging/LoadState.html">LoadState</a></code> to be passed to the UI, and whether there's more data available.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="loadFuture(androidx.paging.LoadType, androidx.paging.PagingState)"></a><a name="loadFuture-androidx.paging.LoadType-androidx.paging.PagingState-"></a><a name="loadfuture"></a>
<h3 class="api-name" id="loadFuture(androidx.paging.LoadType,androidx.paging.PagingState)">loadFuture</h3>
<pre class="api-signature no-pretty-print">abstract&nbsp;fun&nbsp;<a href="/reference/kotlin/androidx/paging/ListenableFutureRemoteMediator.html#loadFuture(androidx.paging.LoadType,androidx.paging.PagingState)">loadFuture</a>(loadType:&nbsp;<a href="/reference/kotlin/androidx/paging/LoadType.html">LoadType</a>,&nbsp;state:&nbsp;<a href="/reference/kotlin/androidx/paging/PagingState.html">PagingState</a>&lt;Key,&nbsp;Value&gt;):&nbsp;<a href="https://guava.dev/releases/18.0/api/docs/package-list/com/google/common/util/concurrent/ListenableFuture.html">ListenableFuture</a>&lt;<a href="/reference/kotlin/androidx/paging/RemoteMediator.MediatorResult.html">RemoteMediator.MediatorResult</a>&gt;</pre>
<p>Implement this method to load additional remote data, which will then be stored for the <code><a href="/reference/kotlin/androidx/paging/PagingSource.html">PagingSource</a></code> to access. These loads take one of two forms:</p>
<ul>
<li>
<p>type == <code><a href="/reference/kotlin/androidx/paging/LoadType.html#PREPEND">LoadType.PREPEND</a></code> / <code><a href="/reference/kotlin/androidx/paging/LoadType.html#APPEND">LoadType.APPEND</a></code> The <code><a href="/reference/kotlin/androidx/paging/PagingSource.html">PagingSource</a></code> has loaded a 'boundary' page, with a <code>null</code> adjacent key. This means this method should load additional remote data to append / prepend as appropriate, and store it locally.</p>
</li>
<li>
<p>type == <code><a href="/reference/kotlin/androidx/paging/LoadType.html#REFRESH">LoadType.REFRESH</a></code> The app (or <code><a href="/reference/kotlin/androidx/paging/ListenableFutureRemoteMediator.html#initialize()">initialize</a></code>) has requested a remote refresh of data. This means the method should generally load remote data, and <b>replace</b> all local data.</p>
</li>
</ul>
<p>The runtime of this method defines loading state behavior in boundary conditions, which affects e.g., <code><a href="/reference/kotlin/androidx/paging/LoadState.html">LoadState</a></code> callbacks registered to <code><a href="/reference/kotlin/androidx/paging/PagingDataAdapter.html">androidx.paging.PagingDataAdapter</a></code>.</p>
<p>NOTE: A <code><a href="/reference/kotlin/androidx/paging/PagingSource.html#load(androidx.paging.PagingSource.LoadParams)">PagingSource.load</a></code> request which is fulfilled by a page that hits a boundary condition in either direction will trigger this callback with <code><a href="/reference/kotlin/androidx/paging/LoadType.html#PREPEND">LoadType.PREPEND</a></code> or <code><a href="/reference/kotlin/androidx/paging/LoadType.html#APPEND">LoadType.APPEND</a></code> or both. <code><a href="/reference/kotlin/androidx/paging/LoadType.html#REFRESH">LoadType.REFRESH</a></code> occurs as a result of <code><a href="/reference/kotlin/androidx/paging/ListenableFutureRemoteMediator.html#initialize()">initialize</a></code>.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="100%">Parameters</th>
</tr>
</thead>
<tbody class="list">
<tr>
<td width="40%"><code>loadType:&nbsp;<a href="/reference/kotlin/androidx/paging/LoadType.html">LoadType</a></code></td>
<td>
<p><code><a href="/reference/kotlin/androidx/paging/LoadType.html">LoadType</a></code> of the boundary condition which triggered this callback.</p>
<ul>
<li>
<p><code><a href="/reference/kotlin/androidx/paging/LoadType.html#PREPEND">LoadType.PREPEND</a></code> indicates a boundary condition at the front of the list.</p>
</li>
<li>
<p><code><a href="/reference/kotlin/androidx/paging/LoadType.html#APPEND">LoadType.APPEND</a></code> indicates a boundary condition at the end of the list.</p>
</li>
<li>
<p><code><a href="/reference/kotlin/androidx/paging/LoadType.html#REFRESH">LoadType.REFRESH</a></code> indicates this callback was triggered as the result of a requested refresh - either driven by the UI, or by <code><a href="/reference/kotlin/androidx/paging/ListenableFutureRemoteMediator.html#initialize()">initialize</a></code>.</p>
</li>
</ul>
</td>
</tr>
<tr>
<td width="40%"><code>state:&nbsp;<a href="/reference/kotlin/androidx/paging/PagingState.html">PagingState</a>&lt;Key,&nbsp;Value&gt;</code></td>
<td>
<p>A copy of the state including the list of pages currently held in memory of the currently presented <code><a href="/reference/kotlin/androidx/paging/PagingData.html">PagingData</a></code> at the time of starting the load. E.g. for load(loadType = END), you can use the page or item at the end as input for what to load from the network.</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="100%">Returns</th>
</tr>
</thead>
<tbody class="list">
<tr>
<td width="40%"><code><a href="https://guava.dev/releases/18.0/api/docs/package-list/com/google/common/util/concurrent/ListenableFuture.html">ListenableFuture</a>&lt;<a href="/reference/kotlin/androidx/paging/RemoteMediator.MediatorResult.html">RemoteMediator.MediatorResult</a>&gt;</code></td>
<td>
<p>MediatorResult signifying what <code><a href="/reference/kotlin/androidx/paging/LoadState.html">LoadState</a></code> to be passed to the UI, and whether there's more data available.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</body>
</html>