I'm using baseAdapter:
@Override
public View getView(int posicao, View convertview, ViewGroup parent) {
View view = convertview;
ViewHolder holder = null;
if (view == null) {
holder = new ViewHolder();
view = inflater.inflate(R.layout.itens_lista, parent, false);
holder.itemNome = (TextView) view.findViewById(R.id.itemNome);
holder.itemEndereco = (TextView) view
.findViewById(R.id.itemEndereco);
view.setTag(holder);
} else {
holder = (ViewHolder) view.getTag();
}
Telefone item = getItem(posicao);
holder.itemNome.setText(item.getNome());
holder.itemEndereco.setText(item.getTelefone());
return view;
}
But the items get "bugged":
When I select an item it has red background color, then I scroll and the color disappears back to the original, because I'm using viewHolder and the view is "recycled or reused"; There are items that have red background color without being the selected item.