Estou com uma dificuldade no momento em que seleciono varios TextView, consigo mudar a cor normalmente e voltar quando o id é o mesmo do que foi selecionado.
Meu problema é o seguinte:
Quando eu mudo a cor do background de varios seguidos vai normal, porém se eu precisar voltar a cor do penultimo ou qualquer outro sem ser o ultimo botão que mudei o background é necessário que eu clique duas vezes. Preciso que no primeiro clique ela já mude o background.
Meu codigo está da seguinte forma:
@SuppressLint("ResourceAsColor")
public String buttonballsClick(View button){
String tag = (String)button.getTag();
int numeroInteiro = Integer.parseInt(tag);
switch (numeroInteiro) {
default:
if (games.selectedTag == null || games.selectedTag != tag){
button.setBackgroundResource(R.mipmap.botao_lotecaa);
games.setActualNumber(tag);
games.selectedTag = tag;
}
else if (games.selectedTag.equals(tag)) {
button.setBackgroundResource(R.mipmap.botao_loteca);
games.selectedTag = null;
}
else {
Toast.makeText(ActivityLotecaCreateGame.this, "Houve um problema: " + tag, Toast.LENGTH_LONG).show();
}
break;
}
return tag;
}