I got about 200+ Country names in my app. I got 200+ flag icons for each country. The flag icons names are equals the country names, so like:
Country name: ENG, icon name eng.png
I want to make a list of them in my app to select country. I dont want to build the layout by manually and add 200+ icons for each and every TextView...
My question is, can i add dynamically somehow ?
Something like this:
private void setIcon(String iconName)
{
countryIcon.setBackgroundResource(R.drawable. /* and i need the magic here*/ +iconName )
}
So can i reference to R.drawable dynamically by somehow with param?