Hi I have some drawables that I run through via switch.
Is it possible run through these in a for statement instead?
Something like...
i=0;
String d = "tab"+i;
R.drawable.[d];
i++;
?
Thanks Aidan
Hi I have some drawables that I run through via switch.
Is it possible run through these in a for statement instead?
Something like...
i=0;
String d = "tab"+i;
R.drawable.[d];
i++;
?
Thanks Aidan
Yes, you can do something like this:
String d = "tab"+i;
int id = getActivity().getResources().getIdentifier(d,
"drawable", getActivity().getPackageName());
Then set your image:
yourImageView.setImageResource(id);