5
在我的应用程序Android的背景信息成为空
类中心的实例为象下面这样:
central.java:
mContext = getApplicationContext();
mMyStuff = new MyStuff(mContext);
的MyStuff类需要得到mContext一些访问资源。
MyStuff.java:
public class MyStuff {
private Context mContext;
public MyStuff(Context c) {
mContext = c;
}
....
private ActionCustom MyAction = new ActionCustom(mContext);
问题是mContext总是甚至在C空不空。我期待这样做的新的MyStuff(mContext)
很抱歉,但它不工作。我在this.mContext = c上放了一个断点,但它永不停止 – Seb
请参阅K的答案。他可能是正确的。 – Laurens
在这种情况下,“mContext = c”和“this.mContext = c”有什么区别? –