4

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

asked May 17, 2012 at 5:43
4
  • 1
    If 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, Commented May 17, 2012 at 5:50
  • please give some source code @user370305 Commented Mar 27, 2014 at 3:34
  • @Cristiana214 - For what question? What is your problem? Describe properly. Commented Mar 27, 2014 at 6:00
  • thanks but i already got it ... Commented Mar 27, 2014 at 8:11

4 Answers 4

1

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.

answered May 17, 2012 at 5:46

Comments

0

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.

answered May 17, 2012 at 5:58

Comments

0

If you are talking about ArrayList merging then You can merge them by using addAll() method of List.

answered May 17, 2012 at 5:46

Comments

0

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!!

answered May 17, 2012 at 6:01

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.