I am trying to set color from a json color array to my custom menu background.
addMenuItem(int bgColor);
json color array =>
[ [ "B71C1C", "C62828"],[ "B71C1C", "C62828"] ] Color String is getting correctly from json
String colorString = "#" + mColors.getJSONArray(i%2).getString(i%2); gives #B71C1C;
While convert it to integer int parseColor = Color.parseColor(colorString); and passing to above menu background;
ie;addMenuItem(parseColor);
I'm getting
android.content.res.Resources$NotFoundException: Resource ID #0xffb71c1c
I think addMenuItem will accept int only from resource. How can I set color from my JSON color file.