I currently defined my colors as constants, for example:
public static final int BG_COLOR = Color.parseColor("#262525");
I want to better my life and define all colors in my colors.xml file, for example:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="bgcolor">#3F51B5</color>
</resources>
Is there an easy refactoring tool to do this with a single click?
Just to clarify: I do know how the resource file works, I also now how to do the coding. So, this is NOT a duplicate as suggested. What I am asking is, is if there is an easy refactor tool to convert colors, defined as constants in my class file, to colors in my xml file.
Now if I would change it, I would add the color to the xml, go through all my code, see where the color is used and change my code. This is fine and this works and I know how to do this. The thing is, it is a manual process, especially when a lot of different objects are used and a lot of different colors are being used.
I am therefore wondering if there is a simpler way to do this, a refactoring tool that does the work for me. I am looking for something similar as what you can do in Android Studio with Strings in an XML-file. In that case, if you hardcode a string, you have the option to move it to the strings.xml file by using the option "Extract string resource".