How do I set an ImageViews source programmatically in Android?
<p>I am making a compound ui element that takes an Object (a player) and I want to pick the corresponding image for the team this player plays for(the player object has a string value for its image number.  I have the images in the resources folder of my project.</p>

<p>How do I specify the correct source for each player.  Is it a case of writing a huge number of if's and elses (checking the string value) and using res.getDrawable(R.drawable.no1) etc or is there a more elegant solution where I can use a string in some way to specify the path to the source?</p>
