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.
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.
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# AsyncListUtil.DataCallback\n\nadded in [version 24.1.0](/topic/libraries/support-library/revisions) \nbelongs to Maven artifact com.android.support:recyclerview-v7:28.0.0-alpha1 \nSummary: [Ctors](#pubctors) \\| [Methods](#pubmethods) \\| [Inherited Methods](#inhmethods) \\| [\\[Expand All\\]](#) \n\nAsyncListUtil.DataCallback\n==========================\n\n| This package is part of the Android [support library](/topic/libraries/support-library) which is no longer maintained. The support library has been superseded by [AndroidX](/jetpack/androidx) which is part of [Jetpack](/jetpack). We recommend using the AndroidX libraries in all new projects. You should also consider [migrating](/jetpack/androidx/migrate) existing projects to AndroidX. To find the AndroidX class that maps to this deprecated class, see the AndroidX support library [class\n| mappings](/jetpack/androidx/migrate/class-mappings).\n\n\n`\npublic\nstatic\n\nabstract\nclass\nAsyncListUtil.DataCallback\n`\n\n\n`\n\nextends Object\n\n\n`\n\n`\n\n\n`\n\n|---|---------------------------------------------------------|\n| java.lang.Object ||\n| ↳ | android.support.v7.util.AsyncListUtil.DataCallback\\\u003cT\\\u003e |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nThe callback that provides data access for [AsyncListUtil](/reference/android/support/v7/util/AsyncListUtil).\n\n\nAll methods are called on the background thread.\n\nSummary\n-------\n\n| ### Public constructors ||\n|----------------------------------------------------------------------------------------------------------------------------------|---|\n| ` `[AsyncListUtil.DataCallback](/reference/android/support/v7/util/AsyncListUtil.DataCallback#AsyncListUtil.DataCallback())`() ` |\n\n| ### Public methods ||\n|------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ` abstract void` | ` `[fillData](/reference/android/support/v7/util/AsyncListUtil.DataCallback#fillData(T[], int, int))`(T[] data, int startPosition, int itemCount) ` Fill the given tile. |\n| ` int` | ` `[getMaxCachedTiles](/reference/android/support/v7/util/AsyncListUtil.DataCallback#getMaxCachedTiles())`() ` Returns tile cache size limit (in tiles). |\n| ` void` | ` `[recycleData](/reference/android/support/v7/util/AsyncListUtil.DataCallback#recycleData(T[], int))`(T[] data, int itemCount) ` Recycle the objects created in [fillData(T[], int, int)](/reference/android/support/v7/util/AsyncListUtil.DataCallback#fillData(T[], int, int)) if necessary. |\n| ` abstract int` | ` `[refreshData](/reference/android/support/v7/util/AsyncListUtil.DataCallback#refreshData())`() ` Refresh the data set and return the new data item count. |\n\n| ### Inherited methods |\n|-----------------------|---|\n| From class ` java.lang.Object ` |-------------------|-------------------------------| | ` Object` | ` clone() ` | | ` boolean` | ` equals(Object arg0) ` | | ` void` | ` finalize() ` | | ` final Class\u003c?\u003e` | ` 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() ` | ||\n\nPublic constructors\n-------------------\n\n### AsyncListUtil.DataCallback\n\nadded in [version 24.1.0](/topic/libraries/support-library/revisions) \n\n```\nAsyncListUtil.DataCallback ()\n```\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\nPublic methods\n--------------\n\n### fillData\n\nadded in [version 24.1.0](/topic/libraries/support-library/revisions) \n\n```\nvoid fillData (T[] data, \n int startPosition, \n int itemCount)\n```\n\nFill the given tile.\n\n\nThe provided tile might be a recycled tile, in which case it will already have objects.\nIt is suggested to re-use these objects if possible in your use case.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|-----------------|------------------------------------------------------------------------------------------|\n| `data` | `T`: The data item array to fill into. Should not be accessed beyond `itemCount`. \u003cbr /\u003e |\n| `startPosition` | `int`: The start position in the list. \u003cbr /\u003e |\n| `itemCount` | `int`: The data item count. \u003cbr /\u003e |\n\n### getMaxCachedTiles\n\nadded in [version 24.1.0](/topic/libraries/support-library/revisions) \n\n```\nint getMaxCachedTiles ()\n```\n\nReturns tile cache size limit (in tiles).\n\n\nThe actual number of cached tiles will be the maximum of this value and the number of\ntiles that is required to cover the range returned by\n[extendRangeInto(int[], int[], int)](/reference/android/support/v7/util/AsyncListUtil.ViewCallback#extendRangeInto(int[], int[], int)).\n\n\nFor example, if this method returns 10, and the most\nrecent call to [extendRangeInto(int[], int[], int)](/reference/android/support/v7/util/AsyncListUtil.ViewCallback#extendRangeInto(int[], int[], int)) returned\n{100, 179}, and the tile size is 5, then the maximum number of cached tiles will be 16.\n\n\nHowever, if the tile size is 20, then the maximum number of cached tiles will be 10.\n\n\nThe default implementation returns 10.\n\n\u003cbr /\u003e\n\n| Returns ||\n|-------|----------------------------|\n| `int` | Maximum cache size. \u003cbr /\u003e |\n\n### recycleData\n\nadded in [version 24.1.0](/topic/libraries/support-library/revisions) \n\n```\nvoid recycleData (T[] data, \n int itemCount)\n```\n\nRecycle the objects created in [fillData(T[], int, int)](/reference/android/support/v7/util/AsyncListUtil.DataCallback#fillData(T[], int, int)) if necessary.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|-------------|-----------------------------------------------------------------------------|\n| `data` | `T`: Array of data items. Should not be accessed beyond `itemCount`. \u003cbr /\u003e |\n| `itemCount` | `int`: The data item count. \u003cbr /\u003e |\n\n### refreshData\n\nadded in [version 24.1.0](/topic/libraries/support-library/revisions) \n\n```\nint refreshData ()\n```\n\nRefresh the data set and return the new data item count.\n\n\nIf the data is being accessed through [Cursor](https://developer.android.com/reference/android/database/Cursor.html) this is where\nthe new cursor should be created.\n\n\u003cbr /\u003e\n\n| Returns ||\n|-------|-------------------------|\n| `int` | Data item count. \u003cbr /\u003e |\n\n-\n\n Interfaces\n ----------\n\n - [ListUpdateCallback](/reference/android/support/v7/util/ListUpdateCallback)\n-\n\n Classes\n -------\n\n - [AdapterListUpdateCallback](/reference/android/support/v7/util/AdapterListUpdateCallback)\n - [AsyncListUtil](/reference/android/support/v7/util/AsyncListUtil)\n - [AsyncListUtil.DataCallback](/reference/android/support/v7/util/AsyncListUtil.DataCallback)\n - [AsyncListUtil.ViewCallback](/reference/android/support/v7/util/AsyncListUtil.ViewCallback)\n - [BatchingListUpdateCallback](/reference/android/support/v7/util/BatchingListUpdateCallback)\n - [DiffUtil](/reference/android/support/v7/util/DiffUtil)\n - [DiffUtil.Callback](/reference/android/support/v7/util/DiffUtil.Callback)\n - [DiffUtil.DiffResult](/reference/android/support/v7/util/DiffUtil.DiffResult)\n - [DiffUtil.ItemCallback](/reference/android/support/v7/util/DiffUtil.ItemCallback)\n - [SortedList](/reference/android/support/v7/util/SortedList)\n - [SortedList.BatchedCallback](/reference/android/support/v7/util/SortedList.BatchedCallback)\n - [SortedList.Callback](/reference/android/support/v7/util/SortedList.Callback)"]]