setBackgroundDrawable() deprecated
It’s an interesting topic. The way you are doing it is correct, apparently. It is actually just a naming decision change. As this answer points out, setBackground() just calls setBackgroundDrawable(): You can see this thread for more information about all of this.