Brill,

Post some code... and the layout you are inflating. I use tags all the time to identify views, so it's definitely possible.


Sincerely,

Brad Gies
-----------------------------------------------------------------------
Bistro Bot - Bistro Blurb
http://bgies.com            http://nocrappyapps.com
http://bistroblurb.com      http://forcethetruth.com
http://ihottonight.com
-----------------------------------------------------------------------
Everything in moderation, including abstinence (paraphrased)

Every person is born with a brain... Those who use it well are the successful 
happy ones - Brad Gies

Adversity can make or break you... It's your choice... Choose wisely - Brad Gies

Never doubt that a small group of thoughtful, committed people can
change the world. Indeed. It is the only thing that ever has - Margaret Mead


On 13/01/2011 10:28 AM, Brill Pappin wrote:
Ok, this is the same problem as my last post, but i'm not getting any traction with it, so i'm looking for another method solve the problem.

All i need to do is identify the xml resource a view was inflated from, in the views constructor.

I've tried android:tag which does not seem to be able to do it in this case (I only ever get null back from getTag()).

The situation is that I have a single java class extending view.
I inflate one of many XMLs into the view and I need to be able to change stylesheets based upon which xml resource i'm loading.

Does anyway one a method of doing this?

My last fallback is to use some sort of static class that I can set the xml resource on for the entire app, then try and look at the id to determine which resource I loaded. I'm reluctant to do that because it's kludgy and I think its far more likely to introduce bug etc. Note that I haven't tried to do this yet, but it should work based on how java behaves.

I just can't believe that there is no way to a view to know what XML resource it was inflated from!

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

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