(1)
for(int i=0; i<10; i++)
{
String picture_Id = "book"+i;
Resources res = getResources();
int picture_id = res.getIdentifier(picture_Id, "drawable", "com.example.bookonline");imageView.setImageResource(picture_id);
}
(2)
for (int i=0; i<10; i++)
{
try {
int Box_id = (int) R.drawable.class.getField("t"+i).get(null);
Boxs[i] = BitmapFactory.decodeResource(context.getResources(), Box_id);
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
}