This is my res/values/color.xml
<resources>
<color name="ColorPrimary">#FF5722</color>
</resources>
this is .java file
Color color = context.getResources().getColor(R.color.ColorPrimary); //Error
textView.setTextColor(color);
It's giving me an error. Required android.graphics.Color. Found int
How can I handle it?
The getColor method returns an int, but you try to store it in a Color object. I suggest you simply do this:
textView.setTextColor(context.getResources().getColor(R.color.ColorPrimary))
Since setTextColor takes an int in parameters.