English | Site Directory

Android - An Open Handset Alliance Project

android.widget
protected class

android.widget.AbsListView.RecycleBin

java.lang.Object
android.widget.AbsListView.RecycleBin

The RecycleBin facilitates resuse of views across layouts. The RecycleBin has two levels of storage: ActiveViews and ScrapViews. ActiveViews are those views which were onscreen at the start of a layout. By construction, they are displaying current information. At the end of layout, all views in ActiveViews are demoted to ScrapViews. ScrapViews are old views that could potentially be used by the adapter to avoid allocating views unnecessarily.

Summary

Protected Constructors

          AbsListView.RecycleBin()

Protected Methods

        void  addScrapView(View scrap)
Put a view into the ScapViews list.
        void  fillActiveViews(int childCount, int firstActivePosition)
Fill ActiveViews with all of the children of the AbsListView.
        View  getActiveView(int position)
Get the view corresponding to the specified position.
        View  getScrapView()
        void  prepareActiveViews(int childCount, int firstActivePosition)
Call this to make sure that ActiveViews has enough storage for the views that it needs to hold.
        void  putActiveView(int position, View activeView)
Add a view to mActiveView
        void  scrapActiveViews()
Move all views remaining in mActiveViews to mScrapViews.
Methods inherited from class java.lang.Object

Details

Protected Constructors

protected AbsListView.RecycleBin()

Protected Methods

protected void addScrapView(View scrap)

Put a view into the ScapViews list. These views are unordered.

Parameters

scrap The view to add

protected void fillActiveViews(int childCount, int firstActivePosition)

Fill ActiveViews with all of the children of the AbsListView. This is equivalent to calling prepareActiveViews(int, int) followed by calls to putActiveView(int, View).

Parameters

childCount The minimum number of views mActiveViews should hold
firstActivePosition The position of the first view that will be stored in mActiveViews

protected View getActiveView(int position)

Get the view corresponding to the specified position. The view will be removed from mActiveViews if it is found.

Parameters

position The position to look up in mActiveViews

Returns

  • The view if it is found, null otherwise

protected View getScrapView()

Returns

  • A view from the ScrapViews collection. These are unordered.

protected void prepareActiveViews(int childCount, int firstActivePosition)

Call this to make sure that ActiveViews has enough storage for the views that it needs to hold.

Parameters

childCount The minimum number of views mActiveViews should hold
firstActivePosition The position of the first view that will be stored in mActiveViews

protected void putActiveView(int position, View activeView)

Add a view to mActiveView

Parameters

position The position of the view being added
activeView The view to add

protected void scrapActiveViews()

Move all views remaining in mActiveViews to mScrapViews.
Build m5-rc15i - 10 Jun 2008 13:54