The following code will get the background color of a view and convert it to the int representation of the color.
ColorDrawable buttonColor = (ColorDrawable) myView.getBackground();
int colorId = buttonColor.getColor();
The following code will get the background color of a view and convert it to the int representation of the color.
ColorDrawable buttonColor = (ColorDrawable) myView.getBackground();
int colorId = buttonColor.getColor();