Craig wrote:
> Thanks! That did it. Here is an example of the code I used:
>
>   final private static int[] colorAttrs = new int[]
> {R.attr.activeColor, ...};
>
> I chained my View constructors:
>   public MyView(Context context) {this(context, null);}
>   public MyView(Context context, AttributeSet attrs) {this(context,
> attrs, 0);}
>   public MyView(Context context, AttributeSet attrs, int defStyle)
> {...}
>
> in the last constructor I have:
>
>   Theme t = context.getTheme();
>   Arrays.sort(colorAttrs);
>   TypedArray themeStyles = t.obtainStyledAttributes(colorAttrs);
>   activeColor = getColor(themeStyles, R.attr.activeColor);
>   ...
>
> with the getColor method:
>
>   private int getColor(TypedArray themeStyles, int attrResid) {
>     return (int)themeStyles.getColor(Arrays.binarySearch(colorAttrs,
> attrResid), 0);
>   }
>
>
> I hope this helps someone else.
> -Craig

i believe its somehow overcomplicated...

how and where did you define "activeColor", and thus
R.attr.activeColor?
can you post xml file where you did it?

pskink
--~--~---------~--~----~------------~-------~--~----~
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]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to