I need to highlight a row in a ListView that was selected (to show the user what he chose), so, it\'s not the one that is going to be chosen, it\'s the one he c
It's much easier to implement this in your layout files and let Android handle the rest...
1) Make sure you have android:choiceMode="" set on your ListView layout (singleChoice, multipleChoice, etc). By default it is set to none.
2) Create a state selector XML file and save it in your drawables folder. In this example, we'll name it state_selector.xml:
3) In your list item layout, add the state_selector.xml file as the background:
If you are using multipleChoice, you can override onItemClick()and set/unset selected items accordingly. Android will change the background color as specified in your state_selector.xml file.