# AsyncListUtil.ViewCallback

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: [Constants](https://developer.android.com/reference/android/support/v7/util/AsyncListUtil.ViewCallback#constants) \| [Ctors](https://developer.android.com/reference/android/support/v7/util/AsyncListUtil.ViewCallback#pubctors) \| [Methods](https://developer.android.com/reference/android/support/v7/util/AsyncListUtil.ViewCallback#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/support/v7/util/AsyncListUtil.ViewCallback#inhmethods) \| [\[Expand All\]](https://developer.android.com/reference/android/support/v7/util/AsyncListUtil.ViewCallback#)  

# AsyncListUtil.ViewCallback

| 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.ViewCallback
`


`

extends Object


`

`


`

|---|----------------------------------------------------|
| java.lang.Object                                      ||
| ↳ | android.support.v7.util.AsyncListUtil.ViewCallback |

<br />

*** ** * ** ***

The callback that links [AsyncListUtil](https://developer.android.com/reference/android/support/v7/util/AsyncListUtil) with the list view.


All methods are called on the main thread.

## Summary

|                                                                                                               ### Constants                                                                                                                ||
|-------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `int` | [HINT_SCROLL_ASC](https://developer.android.com/reference/android/support/v7/util/AsyncListUtil.ViewCallback#HINT_SCROLL_ASC) Scrolling in ascending order (from lower to higher positions in the order of the backing storage).    |
| `int` | [HINT_SCROLL_DESC](https://developer.android.com/reference/android/support/v7/util/AsyncListUtil.ViewCallback#HINT_SCROLL_DESC) Scrolling in descending order (from higher to lower positions in the order of the backing storage). |
| `int` | [HINT_SCROLL_NONE](https://developer.android.com/reference/android/support/v7/util/AsyncListUtil.ViewCallback#HINT_SCROLL_NONE) No scroll direction hint available.                                                                 |

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

|                                                                                                                                        ### Public methods                                                                                                                                        ||
|------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` void`          | ` `[extendRangeInto](https://developer.android.com/reference/android/support/v7/util/AsyncListUtil.ViewCallback#extendRangeInto(int[], int[], int))`(int[] range, int[] outRange, int scrollHint) ` Compute a wider range of items that will be loaded for smoother scrolling. |
| ` abstract void` | ` `[getItemRangeInto](https://developer.android.com/reference/android/support/v7/util/AsyncListUtil.ViewCallback#getItemRangeInto(int[]))`(int[] outRange) ` Compute the range of visible item positions.                                                                      |
| ` abstract void` | ` `[onDataRefresh](https://developer.android.com/reference/android/support/v7/util/AsyncListUtil.ViewCallback#onDataRefresh())`() ` Called when the entire data set has changed.                                                                                               |
| ` abstract void` | ` `[onItemLoaded](https://developer.android.com/reference/android/support/v7/util/AsyncListUtil.ViewCallback#onItemLoaded(int))`(int position) ` Called when an item at the given position is loaded.                                                                          |

| ### Inherited methods |
|-----------------------|---|
| [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/v7/util/AsyncListUtil.ViewCallback#)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() `                    | ||

## Constants

### HINT_SCROLL_ASC

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

```
int HINT_SCROLL_ASC
```

Scrolling in ascending order (from lower to higher positions in the order of the backing
storage).

<br />

Constant Value:

2
(0x00000002)


### HINT_SCROLL_DESC

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

```
int HINT_SCROLL_DESC
```

Scrolling in descending order (from higher to lower positions in the order of the backing
storage).

<br />

Constant Value:

1
(0x00000001)


### HINT_SCROLL_NONE

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

```
int HINT_SCROLL_NONE
```

No scroll direction hint available.

<br />

Constant Value:

0
(0x00000000)


## Public constructors

### AsyncListUtil.ViewCallback

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

```
AsyncListUtil.ViewCallback ()
```

<br />

<br />

## Public methods

### extendRangeInto

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

```
void extendRangeInto (int[] range, 
                int[] outRange, 
                int scrollHint)
```

Compute a wider range of items that will be loaded for smoother scrolling.


If there is no scroll hint, the default implementation extends the visible range by half
its length in both directions. If there is a scroll hint, the range is extended by
its full length in the scroll direction, and by half in the other direction.


For example, if `range` is `{100, 200}` and `scrollHint`
is [HINT_SCROLL_ASC](https://developer.android.com/reference/android/support/v7/util/AsyncListUtil.ViewCallback#HINT_SCROLL_ASC), then `outRange` will be `{50, 300}`.


However, if `scrollHint` is [HINT_SCROLL_NONE](https://developer.android.com/reference/android/support/v7/util/AsyncListUtil.ViewCallback#HINT_SCROLL_NONE), then
`outRange` will be `{50, 250}`

<br />

|                       Parameters                       ||
|--------------|------------------------------------------|
| `range`      | `int`: Visible item range. <br />        |
| `outRange`   | `int`: Extended range. <br />            |
| `scrollHint` | `int`: The scroll direction hint. <br /> |

### getItemRangeInto

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

```
void getItemRangeInto (int[] outRange)
```

Compute the range of visible item positions.


outRange\[0\] is the position of the first visible item (in the order of the backing
storage).


outRange\[1\] is the position of the last visible item (in the order of the backing
storage).


Negative positions and positions greater or equal to [getItemCount()](https://developer.android.com/reference/android/support/v7/util/AsyncListUtil#getItemCount()) are invalid.
If the returned range contains invalid positions it is ignored (no item will be loaded).

<br />

|                    Parameters                     ||
|------------|---------------------------------------|
| `outRange` | `int`: The visible item range. <br /> |

### onDataRefresh

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

```
void onDataRefresh ()
```

Called when the entire data set has changed.

<br />

### onItemLoaded

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

```
void onItemLoaded (int position)
```

Called when an item at the given position is loaded.

<br />

|                Parameters                ||
|------------|------------------------------|
| `position` | `int`: Item position. <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)