title: Android/Java: using a string for a variable
body: <p>I am trying to read in values from a string array in an xml file that contains many arrays.  Currently I am using this to import the array.</p>
  
  <pre><code>String[] NEWARRAYNAME = getResources().getStringArray(R.array.ARRAYNAME);
  </code></pre>
  
  <p>what I would like to do is use a random number to get a random array from my file.  I was thinking of naming all my arrays in the xml document : m1, m2, m3 ect since I couldn't just use a number(I'm trying to emulate a DB tag).  This is what I am doing at the moment to generate a string that incorporates the random number.</p>
  
  <pre><code>int i = random.nextInt(3)+ 1;
  String ID = "m" + Integer.toString(i);
  </code></pre>
  
  <p>So how can I use the string ID to get the array from my xml file.
  using GetResources().getStringArray(R.array.ID) doesn't work.</p>