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

silverlight - Applying a style to ItemContainerStyle in C# -

c# - NullReferenceException in MySqlClient.NativeDriver -

php - How can I merge Nodes & Webform Submissions into instances of one general Content Type in Drupal 6? -