title: Android: How can I use res/integers.xml values in a switch?
body: <p>In my application, I just need some global values with nice names.
  First, what I did was putting them all as "public static final" components into a separate class. </p>
  
  <p>Then I realized that what I did with the global Strings (putting them into res/strings.xml and using them by getString(R.string.string_name)) should also work with integers.</p>
  
  <p>However, I first found out that there's no such thing as getInteger(R.integer.integer_name), but only the rather lengthy way:</p>
  
  <pre><code>Resources r = getResources();
  int integer = getInteger(R.integer.integer_name);
  </code></pre>
  
  <p>Secondly, when I try to use the values in a switch/case expression I only get the message "case expressions must be constant expressions".</p>
  
  <p>So what's the point in using res/integers.xml anyway? I'm just about to put my integers back into some useless class...</p>
  
  <p>Kind regards,
  jellyfish</p>