I'm trying to avoid using rgb values, so this method:
public LineAndPointFormatter(Integer lineColor, Integer vertexColor, Integer fillColor) {
this(lineColor, vertexColor, fillColor, FillDirection.BOTTOM);
}
where I'm supposed to pass in:
LineAndPointFormatter lpf = new LineAndPointFormatter(Color.rgb(0, 0, 200), null, Color.rgb(0, 0, 80));
is working just fine, but I want to use this method:
public LineAndPointFormatter(Context ctx, int xmlCfgId) {
// prevent configuration of classes derived from this one:
if (getClass().equals(LineAndPointFormatter.class)) {
Configurator.configure(ctx, this, xmlCfgId);
}
}
so I can use the colors.xml resource ID and manage all graph colors by setting "colorID" then passing it in later (colorID is showing up as -65536 in the log or some variation of that depending on ). This code is inside a class that's extending Fragment, so I'm wondering if I'm getting the Context correct..
Here are some of the things I've tried:
LineAndPointFormatter seriesFormat = new LineAndPointFormatter(getActivity().getApplicationContext(), getResources().getColor(R.color.blue));
LineAndPointFormatter seriesFormat = new LineAndPointFormatter(getActivity().getApplicationContext(), colorID);
LineAndPointFormatter seriesFormat = new LineAndPointFormatter(getActivity().getApplicationContext(), getResources().getColor(colorID));
and so on..
I'll keep pluggin away, but if anyone is using the Context version of LineAndPointFormatter, maybe you've run into a similar problem?
The exception looks like this:
05-14 12:47:25.917: E/AndroidRuntime(14023): android.content.res.Resources$NotFoundException: Resource ID #0xff0000ff
Do I have to rewrite my colors into the #ff0000ff format??
EDIT: Added colors.xml
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<color name="white">#FFFFFF</color>
<color name="transparent_white">#66FFFFFF</color>
<color name="yellow">#FFFF00</color>
<color name="fuchsia">#FF00FF</color>
<color name="red">#FF0000</color>
<color name="silver">#C0C0C0</color>
<color name="gray">#808080</color>
<color name="olive">#808000</color>
<color name="purple">#800080</color>
<color name="maroon">#800000</color>
<color name="aqua">#00FFFF</color>
<color name="lime">#00FF00</color>
<color name="teal">#008080</color>
<color name="green">#008000</color>
<color name="blue">#0000ff</color>
<color name="navy">#000080</color>
<color name="black">#000000</color>
</resources>