0
I’m having a hard time at the moment when I select several Textview, I can change the color normally and return when the id is the same as the one selected.
My problem is this:
When I change the background color of several in a row it is normal, but if I need to change the penultimate color or any other without being the last button I changed the background it is necessary that I click twice. I need the first click to change the background.
My code is as follows:
@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;
}