Reputation: 313
I'm new into the "Android World" and I've a problem getting a ImageView value, suppose I've a ImageView somewhere in my layout file and I want to retrieve is value, i.e. the value in the "android:src" tag. How I can I do it?
Thanks in advance.
Upvotes: 2
Views: 1938
Reputation: 15119
Once the resource file is compiled the ImageView simply refers to a resource integer in the R file. So the image "src" value will simply be a value once you've retrieved it, and not the string value you placed in your layout file.
Nonetheless, I think you can get that ID through your ImageView's getResources() method.
EDIT: I'm wrong, turns out you can get the string through Resources.getString(int id)
EDIT 2: Looks like getResources might not contain the ID for you either, an Android engineer already answered a similar question: http://groups.google.com/group/android-developers/browse_thread/thread/84d31b244163821d?pli=1
Upvotes: 3