drawable getResources().getIdentifier problem
<p>this is my first time here (I find the website very useful). I'm new to android and I need to find out why I can't dynamically load images in my list view.</p>

<p>I have three arrays of strings:</p>

<pre><code>private String lv_arr[]={"News", 
        "Events", 
        "Other"};
private String lv_arr_d[]={"Get the latest news", 
        "Latest events", 
        "Other description here"};
private String lv_arr_icons[]={"news", "events", "other"};
</code></pre>

<p>My list displays an icon to the left and two lines of text to the right in each list item.
It works ok when I hard code the name of the image (e.g. news).</p>

<pre><code>ArrayList &lt;HashMap &lt;String, Object&gt;&gt; users = 
     new ArrayList &lt;HashMap &lt;String, Object&gt;&gt; ();
     int l = lv_arr.length;
     for (int i = 0; i &lt;l; i++) {
     HashMap &lt;String, Object&gt; user = new HashMap &lt;String, Object&gt; ();

     //get icons
     String uri = "drawable/"+lv_arr_icons[i];

     user.put ( "icon", (Drawable)getResources().getDrawable(
             getResources().getIdentifier(uri, null, getPackageName())));
//the above works ok if i set R.drawable.news 
     user.put ( "label", lv_arr[i].toString()); 
     user.put ( "description",  lv_arr_d[i].toString()); 
     users.add (user); 
     }

     String[] names = {"icon", "label", "description"};
     int[] views = {R.id.icon, R.id.label, R.id.description};

     SimpleAdapter saImageItems = new SimpleAdapter(this.getApplicationContext(), 
             users,  R.layout.optionslistitem, names, views);
       lv1.setAdapter(saImageItems); //lv1 is my ListView
</code></pre>

<p>All images are in the drawable folder.
Any ideas why no image loads when i try to pass on their name and get them from resources?</p>
