i have a android listview. i want to change listview item background when i click one listview item.
and then previous selected item must go back to default backgrou
You should use the built in methods of selecting items in a listview. Manually changing the background is prone to error as you have found.
Add this attribute to the root view in your listview item xml
android:background="?android:attr/activatedBackgroundIndicator"
then call setItemChecked(x, true)
on your ListView where x is the position of the item you want to be selected.
Ensure your listview has a ChoiceMode
set that allows selection (such as "SingleChoice")