I have created a custom adapter and added it on the listview.
After that I have created the AutoCompleteTextView and the Button nemed as Search Button.
So I did stuff for the searching from the list and by clicking on the search button,I scroll the list to the searched text by using this line.
listViewOS.setSelection(position);
My question is
I want to change the color of the row found by the search procedure. I have the position and I am passing the position to the getView and trying to change the color of row using this code.
if(position == posn)
{
Log.i("Log","Inside if");
rowView.setBackgroundResource(R.color.red);
}
return rowView;
It is printing the log when the position matched,but its not changing the background color of the row.
I think it is happening because, I am trying to change the color of the row of listview which is already populated.
So how can I change the color of the row of listview which is already populated.
I want to do this because I want to show the the searched row in the highlighted color.
I have the position, but not able to do this.
please help
Try this :
It works for me.
Thanks.