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

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