views:

28

answers:

1

Hey all, thanks for helping. I'm going through an Android tutorial and I'm trying to access a color I've defined in colors.xml

<color name = "my_background">#3500ffff</color>

Then I'm trying to access this color by name:

Paint background = new Paint();
background.setColor(getResources().getColor(R.color.my_background));

but it doesn't recognize my_background as a resource. If I let the suggestions come up, only a bunch of pre-defined colors pop up that are unrelated. Any ideas? It doesn't make sense for me, I see almost the exact same thing from the developer documentation and another site, but it doesn't work for me.

+2  A: 

I found that the problem was animport android.R somehow made it's way into the top of my code without me noticing. I removed that and the problem was solved.

IronManIngellis
You can accept your own answer to mark it solved. Good find.
Octavian Damiean