Access XML using variables in android [duplicate]
I want access to a picture using
image.setImageResource(R.drawable.photo1);
How can I change "photo1" to "photo" + # (incremented number) so that I can use it with an iteration?
int resID = getResources().getIdentifier("photo"+1,"drawable", getPackageName());
image.setImageResource(resID);
精彩评论