1

アプリを開いたときに 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 を返す可能性はありますか?

4

0 に答える 0