FileDocCategorySizeDatePackage
GridScrollListener.javaAPI DocAndroid 1.5 API2181Wed May 06 22:42:02 BST 2009com.android.frameworktest.gridview

GridScrollListener

public class GridScrollListener extends android.app.Activity implements AbsListView.OnScrollListener
Exercises change notification in a list

Fields Summary
android.os.Handler
mHandler
android.widget.TextView
mText
android.widget.GridView
mGridView
Constructors Summary
Methods Summary
public android.widget.GridViewgetGridView()

        return mGridView;
    
public voidonCreate(android.os.Bundle icicle)


    
        
        super.onCreate(icicle);
        
        setContentView(R.layout.grid_scroll_listener);

        String values[] = new String[1000];
        int i=0;
        for(i=0; i<1000; i++) {
            values[i] = ((Integer)i).toString();
        }
        
        mText = (TextView) findViewById(R.id.text);
        mGridView = (GridView) findViewById(R.id.grid);
        mGridView.setAdapter(new ArrayAdapter<String>(this,
                android.R.layout.simple_list_item_1, values));

        mGridView.setOnScrollListener(this);
    
public voidonScroll(android.widget.AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount)

        int lastItem = firstVisibleItem + visibleItemCount - 1;
        mText.setText("Showing " + firstVisibleItem + "-" + lastItem + "/" + totalItemCount);
    
public voidonScrollStateChanged(android.widget.AbsListView view, int scrollState)