There is a method for doing that, you can retreive resource IDs by string using Resources.getIdentifier() http://developer.android.com/reference/android/content/res/Resources.html
Something like:
int resourceId = Activity.getResources().getIdentifier("testimage", "drawable", "your.package.name");