Is there a mechanism to dynamically obtain a resource?
I mean, let's say I want to show some image depending on context out
of 5 images I have in drawable dir.
So I would expect something like
getResourceByName(String s) : int
which would take a string that points to the resource and will get me
the int of that resource.
for example, I could do then:
ImageView iv = (ImageView) findViewById(R.id.sign_icon);
int imageID getResourceByName("my.package.R.drawable.resname");
iv.setImageResource(imageID);
One way to overcome it would be to hold a hashmap where "resname"
point to appropriate resource and then use the resname to get it, but
I think this should be native. Or it is but I can't figure it out.
Thanks for the help!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---