Resources does not let you access themes -- it doesn't know about a Theme, since there is one Resources object for you application, but an arbitrary number of themes.
Typically to load themed resources, you would do what standard views and widgets do -- declare a styleable array of all of the attributes you want to retrieve, and use Context.obtainStyledAttributes or related to retrieve theme. The LabelView API demo shows an example of this: http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/LabelView.html On Sun, Nov 22, 2009 at 4:22 AM, Stefan <skyntc...@gmail.com> wrote: > In my case I need to be able apply a color conditionally (for example > based if an item is read or unread) so I need to be able to read the > "read" and "unread" colors from the current theme and apply them > appropriately. > > I gave the color special attribute name in my \attr xml file and > assigned it different values in 2 different themes. > if I do getResources().getColorStateList( <my attribute resource ID>) > it fails because it can't find the resource. It seems like something > needs to first resolve the attribute Id to the Id of the resource in > the current theme, but I am not sure what does that. > > Stefan > > -- > 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<android-developers%2bunsubscr...@googlegroups.com> > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en > -- Dianne Hackborn Android framework engineer hack...@android.com Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. -- 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