I am getting the value from webservice first 50 record display in list view .I have load button in footer. if user click load button i will get next 50 record from webservice .how to append first 50 and second 50..n and show it in list view can anybody tell how to do
I am using arraylist of data object
Thanks
-
1If you are using custom adapter, then in your getCount() of adapter just return i+50; and initialize i=50; and call notifyDataSetChanged() on button footer. It will load next 50 to list. Then no need to merge two arraylist,user370305– user3703052012年05月17日 05:50:29 +00:00Commented May 17, 2012 at 5:50
-
please give some source code @user370305Cristiana Chavez– Cristiana Chavez2014年03月27日 03:34:16 +00:00Commented Mar 27, 2014 at 3:34
-
@Cristiana214 - For what question? What is your problem? Describe properly.user370305– user3703052014年03月27日 06:00:06 +00:00Commented Mar 27, 2014 at 6:00
-
thanks but i already got it ...Cristiana Chavez– Cristiana Chavez2014年03月27日 08:11:52 +00:00Commented Mar 27, 2014 at 8:11
4 Answers 4
You just add the new 50 records in to the arraylist which you have passed to the adapter of the list and call adapters notifydatasetchanged method to refresh the list.
Comments
get other 50 records in another temp arraylist and append these with your original Arraylist by calling addAll() method of your original arraylist then after again rebind your listView with adapter having your mearged arraylist.
Comments
If you are talking about ArrayList merging then You can merge them by using addAll()
method of List.
Comments
ListView listView = (ListView)findViewById( R.id.myListView );
final ArrayList listItems = new ArrayList();
final ArrayAdapter adapter = new ArrayAdapter( this, android.R.layout.simple_list_item_1, listItems );
listView.setAdapter( adapter );
Hope it help you!!