I have a class (A_Main.java) extending ArrayAdapter. I set my ListView to use A_Main as it's ListAdapter. Inside A_Main.getView() I inflate the view to get at the ListView widgets for each row. Each row contains a TextView, CheckBox and an ImageButton. When the ImageButton is clicked, I play the song associated with the TextView. I don't want to use onItemClickListener() on the ListView as it's too easy to fumble up a scroll and start playing a new song.
When I click an ImageButton in a new row, I need to un-hilite the ImageButton of the currently playing song, and hilite the new one. I'm thinking the way to do that would be to inflate the view in the ImageButton's onClickListener() and un-hilite every button in the List, then, hi-lite the one which is playing. I'm not sure the best way to go about this. Can I keep a member list in A_Main of each ImageButton ID as getView() iterates over them and reference the ID directly from onClickListener() without causing memory leaks? Do those IDs disappear as soon as getView() is done with them? Any thoughts on alternative approaches?
