dimanche 29 mai 2016

setTextColor depending on random String from array - Android

I have a String array with color names and an array with colors:

String[] words = new String[] {"yellow", "white", "green"};
int[] colors = new int[] {Color.YELLOW, Color.WHITE, Color.GREEN};

My TextView is set to one of these words randomly and now I want to set the text color to yellow if yellow was chosen, etc. I tried this with an if statement, but it keeps showing only black words.




Aucun commentaire:

Enregistrer un commentaire