How do I do pagination using ListView. For an example, I have 12 records in my ListView and I want to show first 10 data in 1st page and the remain data in next page.
Asked
Active
Viewed 197 times
0
-
You can have a look at sectioned adapter in which you can treat each section as a page.And can populate each page with different dataset. – Ashwin N Bhanushali Mar 29 '12 at 11:43
-
any link where i can read more..? – chinna_82 Mar 29 '12 at 11:49
-
you can find it on github. visit the link https://github.com/lytsing/SectionedAdapter – Ashwin N Bhanushali Mar 29 '12 at 11:52
2 Answers
0
You can add a footer on your listview that will hold the buttons for next and back. In an stackoverflow question you have the complete solution for that.
Next step can be done in several ways. The simplest one, that I am seeing right now, is: Save the page you are at a variable. Then, each time you do next you add one to that variable. In your adapter, in the getView you multiply that variable by the position so you can get the correspondent position depending on the page the user is.

Community
- 1
- 1

Tiago Almeida
- 14,081
- 3
- 67
- 82
0
Better way to build view like pages, use Fragment,You can show desire content in pages as you mention in your question, for more details look out section 21 example,it cover fragment.

RobinHood
- 10,897
- 4
- 48
- 97