Skip to content

Most visited

Recently visited

navigation

AsyncListUtil.ViewCallback

public static abstract class AsyncListUtil.ViewCallback
extends Object

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


The callback that links AsyncListUtil with the list view.

All methods are called on the main thread.

Summary

Constants

int HINT_SCROLL_ASC

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

int HINT_SCROLL_DESC

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

int HINT_SCROLL_NONE

No scroll direction hint available.

Public constructors

AsyncListUtil.ViewCallback()

Public methods

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

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

abstract void getItemRangeInto(int[] outRange)

Compute the range of visible item positions.

abstract void onDataRefresh()

Called when the entire data set has changed.

abstract void onItemLoaded(int position)

Called when an item at the given position is loaded.

Inherited methods

From class java.lang.Object

Constants

HINT_SCROLL_ASC

added in version 23.0.0
int HINT_SCROLL_ASC

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

Constant Value: 2 (0x00000002)

HINT_SCROLL_DESC

added in version 23.0.0
int HINT_SCROLL_DESC

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

Constant Value: 1 (0x00000001)

HINT_SCROLL_NONE

added in version 23.0.0
int HINT_SCROLL_NONE

No scroll direction hint available.

Constant Value: 0 (0x00000000)

Public constructors

AsyncListUtil.ViewCallback

added in version 23.0.0
AsyncListUtil.ViewCallback ()

Public methods

extendRangeInto

added in version 23.0.0
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, then outRange will be {50, 300}.

However, if scrollHint is HINT_SCROLL_NONE, then outRange will be {50, 250}

Parameters
range int: Visible item range.

outRange int: Extended range.

scrollHint int: The scroll direction hint.

getItemRangeInto

added in version 23.0.0
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() are invalid. If the returned range contains invalid positions it is ignored (no item will be loaded).

Parameters
outRange int: The visible item range.

onDataRefresh

added in version 23.0.0
void onDataRefresh ()

Called when the entire data set has changed.

onItemLoaded

added in version 23.0.0
void onItemLoaded (int position)

Called when an item at the given position is loaded.

Parameters
position int: Item position.

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!

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 one-minute survey?
Help us improve Android tools and documentation.