blob: e6446a292d5476210df3463248408584b67c0244 [file] [log] [blame]
<html devsite="true">
<head>
<title>PagedList.Callback</title>
{% setvar book_path %}/reference/kotlin/androidx/_book.yaml{% endsetvar %}
{% include "_shared/_reference-head-tags.html" %}
</head>
<body>
<h1>PagedList.Callback</h1>
{% setvar page_path %}androidx/paging/PagedList.Callback.html{% endsetvar %}
{% setvar can_switch %}1{% endsetvar %}
{% include "reference/_kotlin_switcher2.md" %}
<p>
<pre>abstract class PagedList.Callback</pre>
</p>
<hr>
<p>Callback signaling when content is loaded into the list.</p>
<p>Can be used to listen to items being paged in and out. These calls will be dispatched on the dispatcher defined by <code><a href="/reference/kotlin/androidx/paging/PagedList.Builder.html#setNotifyDispatcher(kotlinx.coroutines.CoroutineDispatcher)">PagedList.Builder.setNotifyDispatcher</a></code>, which is generally the main/UI thread.</p>
<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><a href="/reference/kotlin/androidx/paging/PagedList.Callback.html#Callback()">Callback</a>()</code></div>
</td>
</tr>
</tbody>
</table>
</div>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2"><h3>Public functions</h3></th>
</tr>
</thead>
<tbody>
<tr>
<td><code>abstract <a href="/reference/kotlin/kotlin/Unit.html">Unit</a></code></td>
<td width="100%">
<div><code><a href="/reference/kotlin/androidx/paging/PagedList.Callback.html#onChanged(kotlin.Int,kotlin.Int)">onChanged</a>(position:&nbsp;<a href="/reference/kotlin/kotlin/Int.html">Int</a>,&nbsp;count:&nbsp;<a href="/reference/kotlin/kotlin/Int.html">Int</a>)</code></div>
<p>Called when null padding items have been loaded to signal newly available data, or when data that hasn't been used in a while has been dropped, and swapped back to null.</p>
</td>
</tr>
<tr>
<td><code>abstract <a href="/reference/kotlin/kotlin/Unit.html">Unit</a></code></td>
<td width="100%">
<div><code><a href="/reference/kotlin/androidx/paging/PagedList.Callback.html#onInserted(kotlin.Int,kotlin.Int)">onInserted</a>(position:&nbsp;<a href="/reference/kotlin/kotlin/Int.html">Int</a>,&nbsp;count:&nbsp;<a href="/reference/kotlin/kotlin/Int.html">Int</a>)</code></div>
<p>Called when new items have been loaded at the end or beginning of the list.</p>
</td>
</tr>
<tr>
<td><code>abstract <a href="/reference/kotlin/kotlin/Unit.html">Unit</a></code></td>
<td width="100%">
<div><code><a href="/reference/kotlin/androidx/paging/PagedList.Callback.html#onRemoved(kotlin.Int,kotlin.Int)">onRemoved</a>(position:&nbsp;<a href="/reference/kotlin/kotlin/Int.html">Int</a>,&nbsp;count:&nbsp;<a href="/reference/kotlin/kotlin/Int.html">Int</a>)</code></div>
<p>Called when items have been removed at the end or beginning of the list, and have not been replaced by padded nulls.</p>
</td>
</tr>
</tbody>
</table>
</div>
<h2>Public constructors</h2>
<div><a name="Callback--"></a>
<h3 class="api-name" id="Callback()">Callback</h3>
<pre class="api-signature no-pretty-print"><a href="/reference/kotlin/androidx/paging/PagedList.Callback.html#Callback()">Callback</a>()</pre>
</div>
<h2>Public functions</h2>
<div><a name="onChanged(kotlin.Int, kotlin.Int)"></a><a name="onChanged-kotlin.Int-kotlin.Int-"></a>
<h3 class="api-name" id="onChanged(kotlin.Int,kotlin.Int)">onChanged</h3>
<pre class="api-signature no-pretty-print">abstract&nbsp;fun&nbsp;<a href="/reference/kotlin/androidx/paging/PagedList.Callback.html#onChanged(kotlin.Int,kotlin.Int)">onChanged</a>(position:&nbsp;<a href="/reference/kotlin/kotlin/Int.html">Int</a>,&nbsp;count:&nbsp;<a href="/reference/kotlin/kotlin/Int.html">Int</a>):&nbsp;<a href="/reference/kotlin/kotlin/Unit.html">Unit</a></pre>
<p>Called when null padding items have been loaded to signal newly available data, or when data that hasn't been used in a while has been dropped, and swapped back to null.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Parameters</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>position</code></td>
<td width="100%">
<p>Position of first newly loaded items, out of total number of items (including padded nulls).</p>
</td>
</tr>
<tr>
<td><code>count</code></td>
<td width="100%">
<p>Number of items loaded.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="onInserted(kotlin.Int, kotlin.Int)"></a><a name="onInserted-kotlin.Int-kotlin.Int-"></a>
<h3 class="api-name" id="onInserted(kotlin.Int,kotlin.Int)">onInserted</h3>
<pre class="api-signature no-pretty-print">abstract&nbsp;fun&nbsp;<a href="/reference/kotlin/androidx/paging/PagedList.Callback.html#onInserted(kotlin.Int,kotlin.Int)">onInserted</a>(position:&nbsp;<a href="/reference/kotlin/kotlin/Int.html">Int</a>,&nbsp;count:&nbsp;<a href="/reference/kotlin/kotlin/Int.html">Int</a>):&nbsp;<a href="/reference/kotlin/kotlin/Unit.html">Unit</a></pre>
<p>Called when new items have been loaded at the end or beginning of the list.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Parameters</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>position</code></td>
<td width="100%">
<p>Position of the first newly loaded item (in practice, either <code>0</code> or <code>size - 1</code>.</p>
</td>
</tr>
<tr>
<td><code>count</code></td>
<td width="100%">
<p>Number of items loaded.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="onRemoved(kotlin.Int, kotlin.Int)"></a><a name="onRemoved-kotlin.Int-kotlin.Int-"></a>
<h3 class="api-name" id="onRemoved(kotlin.Int,kotlin.Int)">onRemoved</h3>
<pre class="api-signature no-pretty-print">abstract&nbsp;fun&nbsp;<a href="/reference/kotlin/androidx/paging/PagedList.Callback.html#onRemoved(kotlin.Int,kotlin.Int)">onRemoved</a>(position:&nbsp;<a href="/reference/kotlin/kotlin/Int.html">Int</a>,&nbsp;count:&nbsp;<a href="/reference/kotlin/kotlin/Int.html">Int</a>):&nbsp;<a href="/reference/kotlin/kotlin/Unit.html">Unit</a></pre>
<p>Called when items have been removed at the end or beginning of the list, and have not been replaced by padded nulls.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Parameters</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>position</code></td>
<td width="100%">
<p>Position of the first newly loaded item (in practice, either <code>0</code> or <code>size - 1</code>.</p>
</td>
</tr>
<tr>
<td><code>count</code></td>
<td width="100%">
<p>Number of items loaded.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</body>
</html>