25.08.2010 12:38, Lidia G ?????:
I want to create somehow "R.drawable.flag" by appending the country extension "de" .

String countryFlag="flag_"+mySource.countryExtension ; //something like flag_DE countryFlag=countryFlag.toLowerCase(); // =flag_de flag.setBackgroundResource(R.drawable.countryFlag); // of course, it's not working

Some ways to do it:

1 - Set up some kind of data structure with string country names and numeric resource ids. Use it for looking up resource ids by county name.

2 - Use Java reflection to get values from the R class.

-- Kostya

--
Kostya Vasilev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com

--
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