How to set paint.setColor(R.color.white)
first get your color from xml file
int color = context.getResources().getColor(R.color.colorPrimary); // old
is deprecated now, use this instead
int color = ContextCompat.getColor(context, R.color.colorPrimary); // new
set color
paint.setColor(color);
xml file preview: res/values/color.xml
<?xml version="1.0" encoding="utf-8"?><resources> <color name="colorPrimary">#3F51B5</color> <color name="colorPrimaryDark">#303F9F</color> <color name="colorAccent">#FF4081</color></resources>