ImadeamethodforwhenIclickonalistViewitemitwillchangecolor.
Theproblemisthatitalsochangescolorallitemsthathavearangeof12itemitemsthatIclicked.
Forexample:
IhavealistViewwithnumbersfrom1to30,ifIclickthenumber1itwillturngreen,butthe13also25willalsogogreen.
IsawthatthisisalistViewproblembutsomeonehashadasimilarproblemandknowshowtosolveit?
CodeIamusing:
@OverridepublicvoidonItemClick(AdapterView<?>parent,Viewview,intposition,longid){StringstringNomeProduto=adapter.getItem(position);Intenti=newIntent(this,Formulario.class);i.putExtra("stringNomePais", stringNomePais);
i.putExtra("stringIdContinente", getIdContinente);
startActivityForResult(i, 0);
//muda de cor o produto que já foi preenchido
System.out.println("resultado 2: " + resultado);
if (adapter.getItem(position).equals(resultado)) {
View v = adapter.getView(position, view, parent);
v.setBackgroundColor(Color.LTGRAY);
}
adapter.getItem(position);
}