Android (min 2.1): load images from name string
<p>I want to be able to load images dynamically from res/drawable.  I don't how many files there will be, but I do know they will be named by convention as "image_N", where N is sequential integer.  It is possible that new images will be uploaded while the app is running.</p>

<p>My code is basically</p>

<pre><code>Resources rs = getResources();
String imgName = "android.resource://" + this.getPackageName() + "/drawable/image_" + i;
int imgID = rs.getIdentifier(imgName , null, getPackageName());

if (imgID != 0)
{
    Drawable d = rs.getDrawable(imgID);
    //etc.
}
</code></pre>

<p>but <code>imgID</code> being returned is always <code>0</code>.</p>

<p>I also tried another approach</p>

<pre><code>String imgName = "android.resource://" + this.getPackageName() + "/drawable/image_" + i;
b = BitmapFactory.decodeFile(imgName);
if (b != null)
//etc
</code></pre>

<p>But <code>b</code> is always <code>null</code>.</p>

<p>I know there are files in the folder with the right names because I put a few there.  Not sure what I'm doing wrong.  Any help would be greatly appreciated!</p>
