I have used the folowing function to set color filter: public void setColorFilter (int color, PorterDuff.Mode mode) but recently, I have seen that it is deprecated. I have seen in the documentation the following warning to solve the deprecated method:
This method was deprecated in API level 29.
use setColorFilter(android.graphics.ColorFilter) with an instance of BlendModeColorFilter
I have noticed that there was a post were it was said to use the following line of code:
mydrawable.colorFilter = BlendModeColorFilterCompat.createBlendModeColorFilterCompat(color, BlendModeCompat.SRC_ATOP)
I have tried to do that, but the "colorFilter" is not recognized in my project and it is highlighted in red. How could I solve that?
This is the post I saw that possible solution: other post Thanks in advance