Calling context.getResources() returns null
问题 So I am trying to get a string resource in my project but when I called context.getResources().getString(...) , I get a NullPointerException . In debug mode, I found out that the context isn't null but looking at its members, I found out that mResources was null. Why are the resources not loaded for the activity context? EDIT Apparently, this is what triggered the Exception public class MyActivity extends Activity { SomeClass someClass = new SomeClass(this); @Override protected void onCreate