If a large amount of data is loaded during listview loading, the loading time may be too long and the screen is stuck. To solve this problem, check the SDK,
There are two methods in onscrolllistener
You only need to override these two methods to implement rolling loading. For example:
Public void onscroll (abslistview V, int firstvisibleitem,
Int visibleitemcount, int totalitemcount ){
Lastitem = firstvisibleitem + visibleitemcount-1;
If (adapter. Count = lastitem ){
Adapter. Count + = 10;
Adapter. notifydatasetchanged ();
}
}
Public void onscrollstatechanged (abslistview view, int scrollstate ){
// Todo auto-generated method stub
Log. I ("onscrollstatechanged", "onscrollstatechanged ");
}
Public abstract void onscroll (abslistview view, int firstvisibleitem, int visibleitemcount, int totalitemcount)
Since: API Level 1
Callback method to be invoked when the list or grid has been scrolled. This will be called after the scroll has completed
Parameters
View
The view whose scroll state is being reported
Firstvisibleitem
The index of the first visible cell (ignore if visibleitemcount = 0)
Visibleitemcount
The number of visible Cells
Totalitemcount
The number of items in the list adaptor
Public abstract void onscrollstatechanged (abslistview view, int scrollstate)
Since: API Level 1
Callback method to be invoked while the List View or grid view is being scrolled. if the view is being scrolled, this method will be called before the next frame of the scroll is rendered. in particle, it will be called before any calltogetview (INT, view,
Viewgroup ).
Parameters
View
The view whose scroll state is being reported
Scrollstate
The current scroll State. One of scroll_state_idle, scroll_state_touch_scroll orscroll_state_idle.