In meiner AnwendungAndroid Kontext ist null geworden
die Klasse zentrale wird instanziiert als wie unten:
central.java:
mContext = getApplicationContext();
mMyStuff = new MyStuff(mContext);
MyStuff Klasse müssen die mContext bekommen von einigen zugreifen Ressourcen.
MyStuff.java:
public class MyStuff {
private Context mContext;
public MyStuff(Context c) {
mContext = c;
}
....
private ActionCustom MyAction = new ActionCustom(mContext);
Problem ist, dass mContext auch in c immer null ist, ist nicht null. Ich hatte erwartet, dass, wenn die neue MyStuff tun (mContext)
Sorry, aber es funktioniert nicht. Ich habe einen Haltepunkt auf diesem gesetzt.mContext = c aber es hört nie auf – Seb
siehe ρяσѕρєя K's Antwort. Er ist wahrscheinlich richtig. – Laurens
Was ist der Unterschied zwischen "mContext = c" und "this.mContext = c" in diesem Fall? –