Issue
I'm trying to use Color.parseColor() on a color resource:
<color name="redish">#FF0000</color>
I've tried this, but it gives me the error Unknown color:
Color.parseColor(Integer.toHexString(context.getResources().getColor(R.color.redish)))
How do I convert the color resource to a String properly?
Solution
I think you missed #
Color.parseColor("#"+Integer.toHexString(ContextCompat.getColor(context, R.color.redish)))
Answered By - N J
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.