I solved it like this, do you think it is correct?
getColor(int id, Theme theme);
getColor(R.color.green, getContext().getTheme());
Where "green" is in res/colors.xml
:
color name="green">#FF00FF00</color>
I solved it like this, do you think it is correct?
getColor(int id, Theme theme);
getColor(R.color.green, getContext().getTheme());
Where "green" is in res/colors.xml
:
color name="green">#FF00FF00</color>
Use ContextCompat.getColor(context, R.color.color_name)
As this answer shows: getResources().getColor() is deprecated