This article describes the Android implementation of ListView data Dynamic loading method. Share to everyone for your reference, specific as follows:
List.setonscrolllistener (New Onscrolllistener () {///Add scroll bar to bottom, load remaining element public void onscrollstatechanged (Abslistview view, int scrollstate) {//if (scrollstate = = Onscrolllistener.scroll_state_idle) {//This method can be used, but the scroll bar scrolls to the top and also triggers//
Toast.maketext (testlistscroll.this, "OK", Toast.length_short). Show (); Bindviewdata (); Bindviewdata//////This method meets the requirements: Scroll to the low end, load data if (view.getlastvisibleposition () = = (View.getcoun
T ()-1)) {Bindviewdata ()///method of loading Data}//The following method, you can implement a scrolling load, each scroll, the bottom load one. public void Onscroll (Abslistview view, int firstvisibleitem, int visibleitemcount, int totalitemcount) {//scrolling load////T Oast.maketext (testlistscroll.this, "OK" + Firstvisibleitem + "|" + VisibleItemCount + "|" + Totalitemcount, Toast.LENGTH_S
Hort). Show ();
int lastitem = Firstvisibleitem + visibleitemcount; Toast.maketext (testlistscroll.this, "OK" + listitem.size () + Firstvisibleitem + visibleitemcount + lastItem, Toa St.
Length_short). Show (); if (listitem.size() = = LastItem && listitemadapter.getcount () > 0) {//start = end;//end = end + 1;////
Bindviewdata ();
// }
}
});
For more information about Android controls interested readers can view the site: "Android Control Usage Summary"
I hope this article will help you with the Android program.