title: Facebook for android, why can't I use 'this' as the activity to openRequest()?
body: <p>In my activity class I am unable to open a request or set active session using 'this'. My activity is a child of another activity and that seems to be the only difference between it and the login sample given by facebook. When I use 'this' I get this error: </p>
  
  <pre><code>05-24 12:24:27.101: E/AndroidRuntime(30006): FATAL EXCEPTION: main
  05-24 12:24:27.101: E/AndroidRuntime(30006): java.lang.RuntimeException: Unable to resume activity {com.tsavomedia.babynames/com.facebook.LoginActivity}: com.facebook.FacebookException: Cannot call LoginActivity with a null calling package. This can occur if the launchMode of the caller is singleInstance.
  05-24 12:24:27.101: E/AndroidRuntime(30006):    at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2742)
  05-24 12:24:27.101: E/AndroidRuntime(30006):    at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2771)
  05-24 12:24:27.101: E/AndroidRuntime(30006):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2235)
  05-24 12:24:27.101: E/AndroidRuntime(30006):    at android.app.ActivityThread.access$600(ActivityThread.java:141)
  05-24 12:24:27.101: E/AndroidRuntime(30006):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
  05-24 12:24:27.101: E/AndroidRuntime(30006):    at android.os.Handler.dispatchMessage(Handler.java:99)
  05-24 12:24:27.101: E/AndroidRuntime(30006):    at android.os.Looper.loop(Looper.java:137)
  05-24 12:24:27.101: E/AndroidRuntime(30006):    at android.app.ActivityThread.main(ActivityThread.java:5041)
  05-24 12:24:27.101: E/AndroidRuntime(30006):    at java.lang.reflect.Method.invokeNative(Native Method)
  05-24 12:24:27.101: E/AndroidRuntime(30006):    at java.lang.reflect.Method.invoke(Method.java:511)
  05-24 12:24:27.101: E/AndroidRuntime(30006):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
  05-24 12:24:27.101: E/AndroidRuntime(30006):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
  05-24 12:24:27.101: E/AndroidRuntime(30006):    at dalvik.system.NativeStart.main(Native Method)
  05-24 12:24:27.101: E/AndroidRuntime(30006): Caused by: com.facebook.FacebookException: Cannot call LoginActivity with a null calling package. This can occur if the launchMode of the caller is singleInstance.
  05-24 12:24:27.101: E/AndroidRuntime(30006):    at com.facebook.LoginActivity.onResume(LoginActivity.java:110)
  05-24 12:24:27.101: E/AndroidRuntime(30006):    at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1185)
  05-24 12:24:27.101: E/AndroidRuntime(30006):    at android.app.Activity.performResume(Activity.java:5182)
  05-24 12:24:27.101: E/AndroidRuntime(30006):    at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2732)
  05-24 12:24:27.101: E/AndroidRuntime(30006):    ... 12 more
  </code></pre>
  
  <p>I have tried using getParent() in its place however the page redirects to the parent and does not call the callback. Is there a reason I cannot use this and a way to fix it?</p>
  
  <p>EDIT: code</p>
  
  <p>This is what gets called once the button is clicked to login to facebook: </p>
  
  <pre><code>public void getEmail() {
      StatusCallback callback = new StatusCallback() {
          public void call(Session session, SessionState state, Exception exception) {
              if (session.isOpened()) {
                  sendRequests();
              } else if (exception != null) {
                  AlertDialog alertDialog;
                  alertDialog = new AlertDialog.Builder(getParent()).create();
                  alertDialog.setTitle(getParent().getString(R.string.login_fail));
                  alertDialog.setMessage(exception.getMessage());
                  alertDialog.show();
                  mSession = createSession();
              }
          }
      };
      Session session = Session.getActiveSession();
      if (session == null) {
          session = new Session(this);
          if (session.getState().equals(SessionState.CREATED_TOKEN_LOADED) || session.getState().equals(SessionState.CREATED)) {
              session.addCallback(callback);
              session.openForRead(new OpenRequest(this));
              Session.setActiveSession(session);
          }
      } else {
          Session.openActiveSession(this, true, callback);
      }
  }
  </code></pre>