Q:

Is it possible to add images programmatically?

I have a web service where I read various information from. One of these pieces of information is the name of an image. I have all the images stored locally in the drawables folder. What I have done right now is I read the string of the image I need from the web service. I want to use this string name and insert the image with the same string name from my drawable folder. Is this possible to do? 
Is it possible to do the following somehow?
//Setup the image
        ImageView spotIvIcon = (ImageView)findViewById(R.id.spot_selected_image);
        String temp = "R.drawable."+spotImage;
        spotIvIcon.setImageResource(R.drawable.beer);

What I do with the temp string. Is it possible to convert this string into the int I need? I have the beer in there just to test something out. 
Thanks

A:

So I found out how to do this. If anyone wanted to know how it's done use the following code:
int path = getResources().getIdentifier(spotImage, "drawable", "com.androidpeople.tab");
        spotIvIcon.setImageResource(path);

Where:

spotImage is the name of your string
drawable is the type you want
com.androidpeople.tab is your package name

Works like a charm now. 

