title: Facebook Session null on OnActivityResult
body: <p>Using the facebook sdk 3.14 for android when i change my password and then try to login into the app, the facebook native app opens and ask me to enter the new password. The problem is that if i put my app in background and then again resume my app and enter the new password and press log in, the app crashes as my session gets null on OnActivityResult. Can someone suggest that how to avoid session getting null or how to handle it. </p>
  
  <pre><code>// This method gets the user logged in without any permission(basic
  // permissions which are default will be asked).
  @Override
  public void login() {
      session = Session.getActiveSession();
  
                  if (session == null
                  || session.getState() == SessionState.CLOSED_LOGIN_FAILED
                  || session.getState() == SessionState.CLOSED) {
              session = new Session(context);
          }
          if (!session.isOpened()) {
              session.openForRead(new Session.OpenRequest(this));
          }
          Session.setActiveSession(session);
  
  }
  
  
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
      session = Session.getActiveSession();
      session.onActivityResult(this.activity, requestCode, resultCode,
                  data);
      if (resultCode == Activity.RESULT_OK &amp;&amp; session.isOpened()) {
          loginResult(true);
      }
  
      // If the user cancels the login process or it gets cancelled due to
      // some another reason.
      if (resultCode == Activity.RESULT_CANCELED) {
          Log.e("LOGIN", "CANCELLED");
          inter.loginResult(false);
      }
  
  }
  
  
  
  // Facebook Login Result
  @Override
  public void loginResult(boolean result) {
      // TODO Auto-generated method stub
      if (result) {
          Log.e("Facebook Login ", "Successful");
      } else {
          Log.e("Facebook Logout", "Un Successful");
      }
  }
  </code></pre>
  
  <p>The exception which it shows is:</p>
  
  <pre><code>java.lang.RuntimeException: Unable to resume activity   {com.example.FirstDemo/com.example.FirstDemo.FC_LoginActivity}: java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=199188, result=-1, data=Intent { (has extras) }} to activity {com.example.FirstDemo/com.example.FirstDemo.FC_LoginActivity}: java.lang.NullPointerException
  </code></pre>