blob: 7729b26f83e04ed920d3b1117fb5d319c699a341 [file] [log] [blame]
<html devsite="true">
<head>
<title>ItemKeyedDataSource.LoadCallback</title>
{% setvar book_path %}/reference/androidx/_book.yaml{% endsetvar %}
{% include "_shared/_reference-head-tags.html" %}
</head>
<body>
<h1>ItemKeyedDataSource.LoadCallback</h1>
{% setvar page_path %}androidx/paging/ItemKeyedDataSource.LoadCallback.html{% endsetvar %}
{% setvar can_switch %}1{% endsetvar %}
{% include "reference/_java_switcher2.md" %}
<p>
<pre>public abstract class ItemKeyedDataSource.LoadCallback&lt;Value&nbsp;extends&nbsp;<a href="/reference/java/lang/Object.html">Object</a>&gt;</pre>
</p>
<div class="devsite-table-wrapper"><devsite-expandable><span class="expand-control jd-sumtable-subclasses">Known direct subclasses
<div class="showalways" id="subclasses-direct"><a href="/reference/androidx/paging/ItemKeyedDataSource.LoadInitialCallback.html">ItemKeyedDataSource.LoadInitialCallback</a></div>
</span>
<div id="subclasses-direct-summary">
<div class="devsite-table-wrapper">
<table class="responsive">
<tbody>
<tr>
<td><code><a href="/reference/androidx/paging/ItemKeyedDataSource.LoadInitialCallback.html">ItemKeyedDataSource.LoadInitialCallback</a></code></td>
<td width="100%">
<p>Callback for <code><a href="/reference/androidx/paging/ItemKeyedDataSource.html#loadInitial(androidx.paging.ItemKeyedDataSource.LoadInitialParams)">loadInitial</a></code> to return data and, optionally, position/count information.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</devsite-expandable> </div>
<hr>
<p>Callback for ItemKeyedDataSource <code><a href="/reference/androidx/paging/ItemKeyedDataSource.html#loadBefore(androidx.paging.ItemKeyedDataSource.LoadParams)">loadBefore</a></code> and <code><a href="/reference/androidx/paging/ItemKeyedDataSource.html#loadAfter(androidx.paging.ItemKeyedDataSource.LoadParams)">loadAfter</a></code> to return data.</p>
<p>A callback can be called only once, and will throw if called again.</p>
<p>It is always valid for a 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).</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Parameters</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>&lt;Value&nbsp;extends&nbsp;<a href="/reference/java/lang/Object.html">Object</a>&gt;</code></td>
<td width="100%">
<p>Type of items being loaded.</p>
</td>
</tr>
</tbody>
</table>
</div>
<h2>Summary</h2>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2"><h3>Public constructors</h3></th>
</tr>
</thead>
<tbody>
<tr>
<td>
<div><code>&lt;Value&nbsp;extends&nbsp;<a href="/reference/java/lang/Object.html">Object</a>&gt; <a href="/reference/androidx/paging/ItemKeyedDataSource.LoadCallback.html#LoadCallback()">LoadCallback</a>()</code></div>
</td>
</tr>
</tbody>
</table>
</div>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2"><h3>Public methods</h3></th>
</tr>
</thead>
<tbody>
<tr>
<td><code>abstract void</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/paging/ItemKeyedDataSource.LoadCallback.html#onResult(kotlin.collections.List)">onResult</a>(<a href="/reference/java/util/List.html">List</a>&lt;Value&gt;&nbsp;data)</code></div>
<p>Called to pass loaded data from a DataSource.</p>
</td>
</tr>
</tbody>
</table>
</div>
<h2>Public constructors</h2>
<div><a name="LoadCallback--"></a>
<h3 class="api-name" id="LoadCallback()">LoadCallback</h3>
<pre class="api-signature no-pretty-print">public&nbsp;final&nbsp;&lt;Value&nbsp;extends&nbsp;<a href="/reference/java/lang/Object.html">Object</a>&gt; <a href="/reference/androidx/paging/ItemKeyedDataSource.LoadCallback.html#LoadCallback()">LoadCallback</a>()</pre>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Parameters</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>&lt;Value&nbsp;extends&nbsp;<a href="/reference/java/lang/Object.html">Object</a>&gt;</code></td>
<td width="100%">
<p>Type of items being loaded.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<h2>Public methods</h2>
<div><a name="onResult-kotlin.collections.List-"></a>
<h3 class="api-name" id="onResult(kotlin.collections.List)">onResult</h3>
<pre class="api-signature no-pretty-print">public&nbsp;abstract&nbsp;void&nbsp;<a href="/reference/androidx/paging/ItemKeyedDataSource.LoadCallback.html#onResult(kotlin.collections.List)">onResult</a>(<a href="/reference/java/util/List.html">List</a>&lt;Value&gt;&nbsp;data)</pre>
<p>Called to pass loaded data from a DataSource.</p>
<p>Call this method from your ItemKeyedDataSource's <code><a href="/reference/androidx/paging/ItemKeyedDataSource.html#loadBefore(androidx.paging.ItemKeyedDataSource.LoadParams)">loadBefore</a></code> and <code><a href="/reference/androidx/paging/ItemKeyedDataSource.html#loadAfter(androidx.paging.ItemKeyedDataSource.LoadParams)">loadAfter</a></code> methods to return data.</p>
<p>Call this from <code><a href="/reference/androidx/paging/ItemKeyedDataSource.html#loadInitial(androidx.paging.ItemKeyedDataSource.LoadInitialParams)">loadInitial</a></code> to initialize without counting available data, or supporting placeholders.</p>
<p>It is always valid to pass a different amount of data than what is requested. Pass an empty list if there is no more data to load.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Parameters</th>
</tr>
</thead>
<tbody>
<tr>
<td><code><a href="/reference/java/util/List.html">List</a>&lt;Value&gt;&nbsp;data</code></td>
<td width="100%">
<p>List of items loaded from the <code><a href="/reference/androidx/paging/ItemKeyedDataSource.html">ItemKeyedDataSource</a></code>.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</body>
</html>