I have seen that the following method is deprecated : public void setColorFilter (int color, PorterDuff.Mode mode). In the Android documentation I have seen the following recommendation:
This method was deprecated in API level 29.
use setColorFilter(android.graphics.ColorFilter) with an instance of BlendModeColorFilter
I am trying to replace that method to a non-deprecated method but I have not achieved it. I have seen similar posts to this one but they are kotlin version. How could I replace this deprecated method for a non-deprecated method in Java?
Thanks
edit:
What I had using the deprecated method:
public static void setcol(TextView dLabel) {
dLabel.getBackground().setColorFilter(color,android.graphics.PorterDuff.Mode.MULTIPLY);
}
what I have changed to use non-deprecated method that is apparently working to replace the above deprecated method:
public static void setcol(TextView dLabel) {
dLabel.getBackground().setColorFilter(
BlendModeColorFilterCompat.createBlendModeColorFilterCompat(
color,
BlendModeCompat.SRC_OVER
)
);
}