Am I doing anything wrong ? I need to pass the integer variables that I have to the switch.
This works (with numbers):
@BindColor(R.color.white) protected int white;
@BindColor(R.color.black) protected int black;
Passing int value as number
setTextColor(1);
Then, treat at switch:
private void setTextColor(int color){
switch (color){
case 1 : {
textViewUserName.setTextColor(black);
textViewCardNumber.setTextColor(black);
break;
}
case 2 : {
textViewUserName.setTextColor(white);
textViewCardNumber.setTextColor(white);
break;
}
}
}
But when I pass the int white
or black
value, the switch doesn't work. Why?
setTextColor(white);
Now switch the id's
private void setTextColor(int color){
switch (color){
case R.color.black : {
textViewUserName.setTextColor(black);
textViewCardNumber.setTextColor(black);
break;
}
case R.color.white: {
textViewUserName.setTextColor(white);
textViewCardNumber.setTextColor(white);
break;
}
}
}
Nothing happens, no changes at textView color.