In your java class, you can use the following code:
mView.getBackground().setColorFilter(Color.parseColor(<Color code of your choice>), PorterDuff.Mode.DARKEN);
This line above changes the color of the view to the fraction of the color that you offer in Color.parseColor (), and the hue as you define it with PorterDuff.Mode. Call the above code with the click of a button to check if a color change is entering.
source share