How to add arraylist and display in listview in android

I get the value from the webservice of the first 50 entries as a list. I have a download button in the footer. if the user clicks the download button, I will get the next 50 entries from the webservice. How to add the first 50 and second 50..n and show them as a list, can anyone tell how to do this.

I am using arraylist data object

thank

+3
source share
4 answers

get the other 50 entries in another temporary arraylist and add them with your original Arraylist by calling the addAll () method of your original arraylist, and then reinstall your listView using the adapter that has your mearged arraylist.

0
source

50 arraylist, , notifydatasetchanged, .

+1

If you are talking about merging ArrayList, you can combine them using the addAll()list method .

0
source

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 this helps you!

0
source

All Articles