0

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.

Cœur
  • 37,241
  • 25
  • 195
  • 267
chinna_82
  • 6,353
  • 17
  • 79
  • 134

2 Answers2

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