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

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

PostgreSQL 9.x - pg_read_binary_file & inserting files into bytea -

asp.net - call stack missing info on mono with apache and mod_mono -