For a personnal app where the user will be able to draw on a whiteboard, I need to have a dynamic background on an icon.
It’s a kind of paint bucket where the user will be able to select the color of his choice. Basically, when the user clicks on the button, a color picker dialog appears and he can select one. I need the icon background to change with the given color.
My button looks like that:

I need the red color to change to the new one when the user has clicked on the valid button in my dialog. And to add a border on that button after to tell the user this option is selected.
Is there a way to do that programmaticlly or not ? If so how ?
Thanks.
Look to Drawable#setColorFilter.
You can actually use:
This set white pixels to red, where the color format is ARGB.
If it wont work try a more brute solution: https://stackoverflow.com/a/1715673/821054