I have an enumeration that contains elements like DOT\_BLUE, DOT\_YELLOW, SQUARE\_BLUE, SQUARE\_YELLOW etc. I also have a string, say String string = "DOT\_BLUE". Now I want to access the enum depending on what the string is. I'm too lazy to write all the if else statements (there are a lot more elements) and using reflection in Java is tricky becuase I want to run this code on android aswell.

So is there any other more elegant way to access my enum depending on what the string is? I don't know of any, but I'm not a Java expert. So I'd be happy about a clear answer, even if it's "Nope".