But it does not work, it tells me that getResources is not static ... how can I change?
This means that you are trying to call getResources() from a static method, and not from a regular (instance) method. The simplest thing in your case, if mFoo is a TextView or some other widget, call getResources() in the Context accessible from the widget:
mFoo.setTextColor(mFoo.getContext().getResources().getColor(R.color.orange));
However, the fact that you are trying to reference a widget named mFoo from a static method scares me. It just requires a memory leak. I think you really need to rethink the use of static data elements and methods.
CommonsWare
source share