Autogrow ListView in Android

I have searched various questions related to what I am about to ask. I just want to ask for this in a clear and simple way and hopefully get a clear and simple answer :)

I have List

several hundred elements that I want to present to the user in a widget ListView

. I want to start with 50 items first, and as a user scroll at the bottom, I want to add 50 more, and so on. I think GMail Inbox would be a good example of what I need. I'm not interested in the implementation Cursor

- the dataset is pretty simple, as I said, it's simple List

.

Also, let's say it ListView

gets too big, it would be nice to start shredding it from the top so that it behaves like a sliding ruler on it showing about 200 lines (with 30 visible)

+2


source to share


1 answer


You can try EndlessAdapter

. It wraps the ListAdapter

one you supply and allows additional data to be loaded when the user hits the bottom. You can also try removing items from the top (like remove()

on ArrayAdapter

), although I'm a little nervous about this: Android might not make the right decisions if, say, your list doesn't resize, but the row of strings does change.



+3


source







All Articles