Gets the red, blue, or green channel from the Android Color object… here is a solution to the problem.
Gets the red, blue, or green channel from the Android Color object
I think this is a very stupid question, but the Android Color class doesn’t seem to have a separate way to get int from the R, G, B channel of the Color object. Can I get a channel like Java.awt’s Color?
Solution
int color = ContextCompat.getColor(context, R.color.someColor);
int red = Color.red(color);
int blue = Color.blue(color);
int green = Color.green(color);
int alpha = Color.alpha(color);