Skip to content Skip to sidebar Skip to footer

Android How To Limit List Items Display In Listview And A Button Show More

I am getting data from Database and displaying using a custom list adapter in a ListView. I need to display only 10 items in ListView. and after 10th item a button show with text '

Solution 1:

In Base Adapter, initially take i=10; then use this "i" in getCount() method of BaseAdapter.

publicintgetCount() {
// TODO Auto-generated method stubreturn i;
}

And in your "show more" Button click Increment the i, then call adapter.

Ex:

i=i+10;
adapter.notifyDataSetChanged();

Post a Comment for "Android How To Limit List Items Display In Listview And A Button Show More"