Accessing XML enum values from code

view story

http://stackoverflow.com – I've declared a styleable attribute with enum values, like so: <declare-styleable name="TileLayout"> <attr name="rotation" format="integer"> <enum name="top" value="0"/> <enum name="left" value="1"/> <enum name="right" value="2"/> <enum name="bottom" value="3"/> </attr> </declare-styleable> Now I'd like to reference those in my code, preferably within a switch statement. I cannot find any way of doing this other than just hard-coding the values I have in the enum into my code (defeating half the purpose (HowTos)