public class Test extends ListActivity implements OnScrollListener {
Aleph0 adapter = new Aleph0();
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setListAdapter(adapter);
getListView().setOnScrollListener(this);
}
public void onScroll(AbsListView v, int i, int j, int k) { }
public void onScrollStateChanged(AbsListView v, int state) {
if(state == OnScrollListener.SCROLL_STATE_IDLE) {
adapter.count += 10;
adapter.notifyDataSetChanged();
}
}
class Aleph0 extends BaseAdapter {
int count = 40;
public int getCount() { return count; }
public Object getItem(int pos) { return pos; }
public long getItemId(int pos) { return pos; }
public View getView(int pos, View v, ViewGroup p) {
TextView view = new TextView(Test.this);
view.setText("entry " + pos);
return view;
}
}
}