I had this, which was working fine:
public static Integer[] photos = new Integer[]
{R.drawable.photo1,R.drawable.photo2,R.drawable.photo3};
this.setImageResource(photos[mCellNumber]);
But I decided I wanted to put the filenames in an XML file instead, which I did, like this:
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<array name="Red">
<item>R.drawable.photo1</item>
<item>R.drawable.photo2</item>
<item>R.drawable.photo3</item>
</array>
</resources>
And tried stuff like this:
String[] month = getResources().getStringArray(R.array.Red);
this.setImageResource(month[mCellNumber]);
..and..
String[] month = getResources().getStringArray(R.array.Red);
int bla = Integer.parseInt(month[mCellNumber]);
this.setImageResource(bla);
I understand why it's not working (strings/ints), but I haven't found any simple way of handling the string to integer conversion part or alternatively, using setImageResource with a string as parameter. Any suggestions?