I can't post a comment, so I must put this in as a new response. I completely agree with Sky Kelsey w.r.t. design choice of using color resource type. However, I found the suggest method to access them did not work. This is the way I implemented the use of an XML array to easily loop through a list of colors and apply the colors to various (Custom painted) views.
First the array in arrays.xml:
@color/ingr_red1
@color/ingr_orange1
@color/ingr_yellow1
@color/ingr_green1
@color/ingr_blue1
@color/ingr_violet1
@color/ingr_red2
@color/ingr_orange2
@color/ingr_yellow2
@color/ingr_green2
@color/ingr_blue2
@color/ingr_violet2
Then in color.xml:
#FFCC0000
#FFED5F21
#FFFAE300
#FF5B9C0A
#FF0A0D9C
#FF990A9C
#FFFFCCCC
#FFFFEACC
#FFFFFECC
#FFC7F5C4
#FFC4DAF4
#FFE1C4F4
Then to use it:
TypedArray ta = res.obtainTypedArray(R.array.ingr_color_arr);
int colorToUse = ta.getResourceId(intGroupNum.intValue() - 1, R.color.recipe_detail_border);
paint.setColor(colorToUse);
The key here is to use getResourceId because setColor(int) is going to expect a resource id for a color. I was getting "Resource not found" errors when I tried getting the value with getIntArray() or getColor().
The most popular answer may work...I didn't try it because I preferred the 'array of colors' design choice better.