# AsyncListUtil.DataCallback

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  
belongs to Maven artifact com.android.support:recyclerview-v7:28.0.0-alpha1  
Summary:[Ctors](https://developer.android.com/reference/android/support/v7/util/AsyncListUtil.DataCallback#pubctors)\|[Methods](https://developer.android.com/reference/android/support/v7/util/AsyncListUtil.DataCallback#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/android/support/v7/util/AsyncListUtil.DataCallback#inhmethods)\|[\[Expand All\]](https://developer.android.com/reference/android/support/v7/util/AsyncListUtil.DataCallback#)  

# AsyncListUtil.DataCallback

| This package is part of the Android[support library](https://developer.android.com/topic/libraries/support-library)which is no longer maintained. The support library has been superseded by[AndroidX](https://developer.android.com/jetpack/androidx)which is part of[Jetpack](https://developer.android.com/jetpack). We recommend using the AndroidX libraries in all new projects. You should also consider[migrating](https://developer.android.com/jetpack/androidx/migrate)existing projects to AndroidX. To find the AndroidX class that maps to this deprecated class, see the AndroidX support library[class mappings](https://developer.android.com/jetpack/androidx/migrate/class-mappings).

`
public
static

abstract
class
AsyncListUtil.DataCallback
`  
`

extends Object


``


`

|---|---------------------------------------------------------|
| java.lang.Object                                           ||
| ↳ | android.support.v7.util.AsyncListUtil.DataCallback\<T\> |

<br />

*** ** * ** ***

The callback that provides data access for[AsyncListUtil](https://developer.android.com/reference/android/support/v7/util/AsyncListUtil).

All methods are called on the background thread.

## Summary

|                                                                     ### Public constructors                                                                      ||
|---------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| ` `[AsyncListUtil.DataCallback](https://developer.android.com/reference/android/support/v7/util/AsyncListUtil.DataCallback#AsyncListUtil.DataCallback())`() ` |

|                                                                                                                                                                            ### Public methods                                                                                                                                                                             ||
|------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` abstract void` | ` `[fillData](https://developer.android.com/reference/android/support/v7/util/AsyncListUtil.DataCallback#fillData(T[], int, int))`(T[] data, int startPosition, int itemCount) ` Fill the given tile.                                                                                                                                                   |
| ` int`           | ` `[getMaxCachedTiles](https://developer.android.com/reference/android/support/v7/util/AsyncListUtil.DataCallback#getMaxCachedTiles())`() ` Returns tile cache size limit (in tiles).                                                                                                                                                                   |
| ` void`          | ` `[recycleData](https://developer.android.com/reference/android/support/v7/util/AsyncListUtil.DataCallback#recycleData(T[], int))`(T[] data, int itemCount) ` Recycle the objects created in[fillData(T[], int, int)](https://developer.android.com/reference/android/support/v7/util/AsyncListUtil.DataCallback#fillData(T[], int, int))if necessary. |
| ` abstract int`  | ` `[refreshData](https://developer.android.com/reference/android/support/v7/util/AsyncListUtil.DataCallback#refreshData())`() ` Refresh the data set and return the new data item count.                                                                                                                                                                |

| ### Inherited methods |
|-----------------------|---|
| [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/v7/util/AsyncListUtil.DataCallback#)From class` java.lang.Object ` |-------------------|-------------------------------| | ` Object`         | ` clone() `                   | | ` boolean`        | ` equals(Object arg0) `       | | ` void`           | ` finalize() `                | | ` final Class<?>` | ` getClass() `                | | ` int`            | ` hashCode() `                | | ` final void`     | ` notify() `                  | | ` final void`     | ` notifyAll() `               | | ` String`         | ` toString() `                | | ` final void`     | ` wait(long arg0, int arg1) ` | | ` final void`     | ` wait(long arg0) `           | | ` final void`     | ` wait() `                    | ||

## Public constructors

### AsyncListUtil.DataCallback

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
AsyncListUtil.DataCallback ()
```

<br />

<br />

## Public methods

### fillData

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
void fillData (T[] data, 
                int startPosition, 
                int itemCount)
```

Fill the given tile.

The provided tile might be a recycled tile, in which case it will already have objects. It is suggested to re-use these objects if possible in your use case.

<br />

|                                                Parameters                                                ||
|-----------------|-----------------------------------------------------------------------------------------|
| `data`          | `T`: The data item array to fill into. Should not be accessed beyond`itemCount`. <br /> |
| `startPosition` | `int`: The start position in the list. <br />                                           |
| `itemCount`     | `int`: The data item count. <br />                                                      |

### getMaxCachedTiles

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
int getMaxCachedTiles ()
```

Returns tile cache size limit (in tiles).

The actual number of cached tiles will be the maximum of this value and the number of tiles that is required to cover the range returned by[extendRangeInto(int[], int[], int)](https://developer.android.com/reference/android/support/v7/util/AsyncListUtil.ViewCallback#extendRangeInto(int[], int[], int)).

For example, if this method returns 10, and the most recent call to[extendRangeInto(int[], int[], int)](https://developer.android.com/reference/android/support/v7/util/AsyncListUtil.ViewCallback#extendRangeInto(int[], int[], int))returned {100, 179}, and the tile size is 5, then the maximum number of cached tiles will be 16.

However, if the tile size is 20, then the maximum number of cached tiles will be 10.

The default implementation returns 10.

<br />

|              Returns              ||
|-------|----------------------------|
| `int` | Maximum cache size. <br /> |

### recycleData

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
void recycleData (T[] data, 
                int itemCount)
```

Recycle the objects created in[fillData(T[], int, int)](https://developer.android.com/reference/android/support/v7/util/AsyncListUtil.DataCallback#fillData(T[], int, int))if necessary.

<br />

|                                       Parameters                                        ||
|-------------|----------------------------------------------------------------------------|
| `data`      | `T`: Array of data items. Should not be accessed beyond`itemCount`. <br /> |
| `itemCount` | `int`: The data item count. <br />                                         |

### refreshData

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
int refreshData ()
```

Refresh the data set and return the new data item count.

If the data is being accessed through[Cursor](https://developer.android.com/reference/android/database/Cursor.html)this is where the new cursor should be created.

<br />

|            Returns             ||
|-------|-------------------------|
| `int` | Data item count. <br /> |

-

  ## Interfaces

  - [ListUpdateCallback](https://developer.android.com/reference/android/support/v7/util/ListUpdateCallback)
-

  ## Classes

  - [AdapterListUpdateCallback](https://developer.android.com/reference/android/support/v7/util/AdapterListUpdateCallback)
  - [AsyncListUtil](https://developer.android.com/reference/android/support/v7/util/AsyncListUtil)
  - [AsyncListUtil.DataCallback](https://developer.android.com/reference/android/support/v7/util/AsyncListUtil.DataCallback)
  - [AsyncListUtil.ViewCallback](https://developer.android.com/reference/android/support/v7/util/AsyncListUtil.ViewCallback)
  - [BatchingListUpdateCallback](https://developer.android.com/reference/android/support/v7/util/BatchingListUpdateCallback)
  - [DiffUtil](https://developer.android.com/reference/android/support/v7/util/DiffUtil)
  - [DiffUtil.Callback](https://developer.android.com/reference/android/support/v7/util/DiffUtil.Callback)
  - [DiffUtil.DiffResult](https://developer.android.com/reference/android/support/v7/util/DiffUtil.DiffResult)
  - [DiffUtil.ItemCallback](https://developer.android.com/reference/android/support/v7/util/DiffUtil.ItemCallback)
  - [SortedList](https://developer.android.com/reference/android/support/v7/util/SortedList)
  - [SortedList.BatchedCallback](https://developer.android.com/reference/android/support/v7/util/SortedList.BatchedCallback)
  - [SortedList.Callback](https://developer.android.com/reference/android/support/v7/util/SortedList.Callback)