onItemClick for custom ArrayAdapter - with recycled views
-
23-06-2021 - |
Question
Does anyone have a good tutorial for implementing onItemClick()
for a ListView
populated by a custom ArrayAdapter
?
I'm struggling with how Android is recycling views, and how to affect the layout of the selected view (which is a RelativeLayout
). The way I've implemented it, I'm just doing a simple background colour change, but everytime I choose a row, when I scroll the ListView
there are other off screen items selected too.
Any ideas?
Solution
Have a look to this answer. Custom code of ArrayAdapter.getView()
(where view recycling is done) might be useful to you, I was trying to achieve something similar and it worked for me at last :)
OTHER TIPS
You can find lots of good examples of the custom Listview with Adapters.Some of the Examples are listed below: