Hi all! I have build an application in android. This app needs to display a list of text, but the list of text increase continuously. It means user can see increased list of text. Each text is separated by a horizontal row. It looks like google market when market try to show list of applications. How can i do in this situation ?
+1
A:
You didn't mention where the data came from but let's suppose that you have an ArrayList
of your model Text
.
Steps:
- Add a
ListView
to your layout - Extend
ArrayAdapter
- Set this new adapter to your
ListView
- Modify the array adding/removing new stuff
- Notify the
ListView
that the data has changed using the adapter'snotifyDataSetChanged()
method.
Macarse
2010-10-13 13:48:44
hi Macarse! Thanks for your answer! I mean my list can change continuously but users don't have to wait. It looks like google market when market try to show applications on a category! Thanks.
Thành Lê
2010-10-13 13:59:39
@Nguyên Thành: If you are willing to do something like that I would recommend you search for `Endless Adapter`. It's a piece of code done by Mark Murphy which does exactly that.
Macarse
2010-10-13 14:04:09
Thanks! I think i have what i need. Thanks Macarse!
Thành Lê
2010-10-13 14:27:33