I am developing one app and in that i have one listview. In listview i want to change color of selected items only. It means if i clicked on 1st item it should change color and then again i click on 2nd item then color of 1st item will become normal and it will change color of 2nd item. Here i am using custom listview. and here position
is selected item and CommonUtilities.getListPosition()
is globally defined method for storing position. I am able to change color on select but when i click on 2nd item color doesn't change to its previous color.
if (position == CommonUtilities.getListPosition()) {
v.setBackgroundColor(Color.CYAN);
}else{
v.setBackgroundColor(Color.WHITE);
}