Inside MyListViewAdapter
I make changes to the convertView
visually, but these changes persist on other row items as the list gets reused. In other words now every forth row is red. Now what? How do I prevent this?
View getView(View convertView, int position etc)
{
Button myButton = (Button)convertView.findViewById(R.id.myButton);
myButton.setTag(convertView);
myButton.setOnclickListener( new OnClickListener(){
public void onClick(View v){
View containingView = myButton.getTag();
containingView.setBackgroundColor(Color.RED);
}
});
}
The problem is the view gets reused so now I have a red list item elsewhere and not just where for the cell representing the view I intended. Whats the solutions for this? How to keep view from getting reused in this manner?