I am using a ListView with an ArrayAdapter, and I want to change the color of text inside of a TextView when the user clicks on it. This works fine except when one TextView changes color another one further down the list changes color too.
Does this have something to do with ArrayAdapter reusing views?
ArrayAdapter<String> adapter = new ArrayAdapter<> (thisContext, R.layout.textview_1, arrayList);
listView.setAdapter (adapter);
listView.setOnItemClickListener (new AdapterView.OnItemClickListener ()
{
@Override
public void onItemClick (AdapterView<?> parent, View view, int position, long id)
{
TextView textToChange = (TextView) view;
textToChange.setTextColor (Color.RED);
}
});