当我打开我的应用程序时,我得到一个Nullpointer异常,这是在后台。我的onResume调用一个调用此方法的Asyntask:
public boolean reloadIni() throws NetworkConnetionException {
if(mMyApp == null)//chek if the object has been deleted by the gc.
{
Log.d(TAG,"task mMyApp is null, initialize mMyApp");
mMyApp = (MyApp) getApplicationContext();
}
User userLogin = mMyApp.getUserLogin();
//....more stuff
}
但是如果我的变量mMyApp是!= null,你可以看到我正在检查。 getApplicationContext()是否可能返回null?