title: android: Universal Image Loader get drawable from string array
body: <p>Mostly I found like this on Internet</p>
  
  <pre><code>public static final String[] imageurl = new String[] {
      "http://sample.com/sample1.png",
      "http://sample.com/sample1.png"
  };
  </code></pre>
  
  <p>So when loading image we just need to call</p>
  
  <pre><code>imageloader.displayImage(imageurl[position], imageView, options);
  </code></pre>
  
  <p><b>MY QUESTION</b></p>
  
  <p>I have string array inside arrays.xml</p>
  
  <pre><code>&lt;string-array name="sample" &gt;
      &lt;item&gt;image1&lt;/item&gt;
      &lt;item&gt;image2&lt;/item&gt;
      &lt;item&gt;image3&lt;/item&gt;
      &lt;item&gt;image4&lt;/item&gt;
  &lt;/string-array&gt;
  </code></pre>
  
  <p>Then I'm trying to read sample string array inside arrays.xml</p>
  
  <pre><code>....
  ArrayList&lt;Integer&gt; list = new ArrayList&lt;Integer&gt;();
  ....
  
  final Resources resources = getResources();
  final String packageName = getApplication().getPackageName();
  final String[] extras = resources.getStringArray(R.array.sample);
  for (String extra : extras) {
      int res = resources.getIdentifier(extra, "drawable", packageName);
      if (res != 0) {
          list.add(res);
      }
  }
  </code></pre>
  
  <p><b>HOW TO LOAD IMAGES FROM ARRAYLIST?</b></p>
  
  <p>It's like</p>
  
  <pre><code>imageloader.displayImage(list.get(position), imageView, options);
  </code></pre>
  
  <p><b>OR</b></p>
  
  <p><b>HOW TO SET STRING[] FROM STRING ARRAY INSIDE ARRAYS.XML?</b></p>
  
  <p>I don't want to set it manually like this</p>
  
  <pre><code>public static final String[] imageurl = new String[] {
      "drawable://" R.drawable.image1
      "drawable://" R.drawable.image2
      ...
  };
  </code></pre>