Android - getResources() and static -


i've got class

public class preferences extends preferenceactivity implements onsharedpreferencechangelistener 

out of try call method class. method contains:

mfoo.settextcolor(getresources().getcolor(r.color.orange)) 

but doesn't work. tells me getresources isn't static... how can change this?

but doesnt work, tells me, getresources isnt static... how can change?

this means trying call getresources() static method, rather regular (instance) method. easiest thing in case, if mfoo textview or other widget, call getresources() on context available widget:

mfoo.settextcolor(mfoo.getcontext().getresources().getcolor(r.color.orange)); 

however, fact trying reference widget named mfoo static method scares crap out of me. asking memory leak. think need reconsider use of static data members , methods.


Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -