title: Android getResources().getStringArray() variables
body: <p>I have an xml file, where there are strings and string-arrays. I have a class where I click on a listitem, and in the other class I list other items. In the xml there are string which names are the clicked items modified name, and the values are the string-arrays name. I have found a solution how to add a variable to the getResources(9.getStringArray() but it doesn't work. The program starts, but when I click any of the listitem my activity just stops working.
  My class file:</p>
  
  <pre><code>String artistpicked = extras.getString("artist");
  String[] firstW = artistpicked.split(" ");
  firstW[0] = firstW[0].trim();
  String albumSearch = firstW[0] + "_code";
  int getRes = getResources().getIdentifier(albumSearch, "string", getPackageName());
  String setRes = String.valueOf(getRes);
  int getRes2 = getResources().getIdentifier(setRes, "array", getPackageName());
  String[] albums = getResources().getStringArray(getRes2);
  setListAdapter(new ArrayAdapter&lt;String&gt;(this, R.layout.list_item, albums));
  TextView t = (TextView) findViewById(R.id.albumName);
  t.setText(setRes);
  </code></pre>
  
  <p>The TextView is there to check the variables. The albumSearch gives "modifiedartistpicked_code", it's good. The getRes gives the value of from the xml ("something_array"), the setRes gives it's actual id number (which the getStringArray requires). The getRes2 gives the same as getRes it's just there to check that it works fine. When I comment out the next two lines, the String albums[], and setListAdapter then the program works but it doesn't list the items.</p>
  
  <p>The xml file:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;resources&gt;
      &lt;string-array name="artists_array"&gt;
          &lt;item&gt;code1 example&lt;/item&gt;
          &lt;item&gt;code2 example&lt;/item&gt;
      &lt;/string-array&gt;
      &lt;string-array name="code1_array"&gt;
          &lt;item&gt;item1&lt;/item&gt;
          &lt;item&gt;item2&lt;/item&gt;
          &lt;item&gt;item3&lt;/item&gt;
      &lt;/string-array&gt;
      &lt;string-array name="code2_array"&gt;
          &lt;item&gt;item1&lt;/item&gt;
          &lt;item&gt;item2&lt;/item&gt;
          &lt;item&gt;item3&lt;/item&gt;
      &lt;/string-array&gt;
      &lt;string name="code1_code"&gt;code1_array&lt;/string&gt;
      &lt;string name="code2_code"&gt;code2_array&lt;/string&gt;
  &lt;/resources&gt;
  </code></pre>
  
  <p>I hope I was able to write what I would like to do, and what is the problem :)</p>
  
  <p><strong>Update:</strong></p>
  
  <p>@Marc Bernstein: Because I don't know it's code1_array. First I made many if and when the picked item was x, then I read the R.array.x_array, etc...</p>
  
  <p>But I have got what was the problem, there were capital letters int he name of the strings in xml. Thats why I hate xml, the problem is always there :) This xml was just an example, the original is much greater that's why no one was able to help. Next time I will be much more cautious.</p>
  
  <p>And also I made it now more simplier because you have right it was too complicated.</p>