Hi,

I have a button and i put a picture in it. I have a list of pictures
and i want to know what is the best practice to adapt a integer to a
drawable name.

By example, i have :
if (element == 0) {
       button.setBackgroundResource(R.drawable.picture_0);
} else if (element== 1) {
       button.setBackgroundResource(R.drawable.picture_1);
} else if (element == 2) {
       button.setBackgroundResource(R.drawable.picture_2);
} else if (element== 3) {
       button.setBackgroundResource(R.drawable.picture_3);
}

and i want to get something like :
button.setBackgroundResource("R.drawable.picture_" + element);

Thanks
Sylvain MOUQUET

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to