The method of dynamic loading of ListView data by Android _android

Source: Internet
Author: User

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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.