1
I’m having a hard time making a comparison logic or something better that you can point out to me.
I’m developing an app that contains several buttons in mega sena game format.
I need to make sure that if a ball is already selected the color changes to green and if it receives a new click goes back to white (I am already able to do this ), but I need that if you already have a ball selected should not have the possibility of it selecting a new.
My code:
public void buttonClick(View button){
String tag = (String)button.getTag();
int numeroInteiro = Integer.parseInt(tag);
switch (numeroInteiro){
default:
if (ballsColor()){
button.setBackgroundResource(R.mipmap.ball_verde);
}else {
button.setBackgroundResource(R.mipmap.ball);
}
break;
}
}
private boolean ballsColor(){
if (count == 0){
count++;
return true;
} else {
count--;
return false;
}
}
Is there any way to save a value and not be overwritten in a new button action?
It worked fine, thank you very much!!
– Edi