Skip to content

Most visited

Recently visited

navigation
added in version 24.1.0
belongs to Maven artifact com.android.support:recyclerview-v7:27.0.0

AsyncListUtil.DataCallback

public static abstract class AsyncListUtil.DataCallback
extends Object

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


The callback that provides data access for AsyncListUtil.

All methods are called on the background thread.

Summary

Public constructors

AsyncListUtil.DataCallback()

Public methods

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

Fill the given tile.

int getMaxCachedTiles()

Returns tile cache size limit (in tiles).

void recycleData(T[] data, int itemCount)

Recycle the objects created in fillData(T[], int, int) if necessary.

abstract int refreshData()

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

Inherited methods

From class java.lang.Object

Public constructors

AsyncListUtil.DataCallback

added in version 24.1.0
AsyncListUtil.DataCallback ()

Public methods

fillData

added in version 24.1.0
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.

Parameters
data T: The data item array to fill into. Should not be accessed beyond itemCount.

startPosition int: The start position in the list.

itemCount int: The data item count.

getMaxCachedTiles

added in version 24.1.0
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).

For example, if this method returns 10, and the most recent call to 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.

Returns
int Maximum cache size.

recycleData

added in version 24.1.0
void recycleData (T[] data, 
                int itemCount)

Recycle the objects created in fillData(T[], int, int) if necessary.

Parameters
data T: Array of data items. Should not be accessed beyond itemCount.

itemCount int: The data item count.

refreshData

added in version 24.1.0
int refreshData ()

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

If the data is being accessed through Cursor this is where the new cursor should be created.

Returns
int Data item count.

This site uses cookies to store your preferences for site-specific language and display options.

Get the latest Android developer news and tips that will help you find success on Google Play.

* Required Fields

Hooray!

Follow Google Developers on WeChat

Browse this site in ?

You requested a page in , but your language preference for this site is .

Would you like to change your language preference and browse this site in ? If you want to change your language preference later, use the language menu at the bottom of each page.

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a short survey?
Help us improve the Android developer experience.
(Sep 2017 survey)