How can I make my listview cycle as in when the user reaches the bottom it essentially just reloads the top values and makes it an endless cycle?
Asked
Active
Viewed 757 times
2 Answers
1
My thought process for your adapter would be:
- Override
getCount()and returnMAX_INT - For
getItem(), return your item atposition % actualCount(i.e. if you're using a List calleditemsfor the backing data, returnitems.get(pos % items.size())). - In
getView(), make sure that you're always accessing data usinggetItem()rather than accessing the backing data directly (e.g. don't accessitems.get(pos), as you'll have to again mod against the length of the list)
Kevin Coppock
- 133,643
- 45
- 263
- 274
-
Definitely check the commented duplicate, looks like a great solution! – Kevin Coppock Mar 11 '13 at 21:54
0
This is just off of top of my head, but I think roughly what you could do is, similar to detecting end in infinite-scrolling, when you're at the bottom, append to your ArrayList to itself then call an update like notifyDataSetChanged on the adapter?
Nearalias
- 25
- 1
- 4