I have an integer array in an xml file as follows
- @drawable/pic1
- @drawabl
You need to get an array with id's of your images. Probably this article helps you. And so the code you probably need:
int[] picArray = new int[4];
for (int i = 1; i <=4; i++)
{
try
{
Class res = R.drawable.class;
Field field = res.getField("pic"+i);
picArray[i-1] = field.getInt(null);
}
catch (Exception e)
{
Log.e("MyTag", "Failure to get drawable id.", e);
}
}