title: Android Facebook Login begin called twice
body: <p>I am trying to use Facebook login in my <code>AppCompatActivity</code>. But when the user presses the login button and logs in and is returned to my activity, its being called again:</p>
  
  <pre><code>    //FACEBOOK
          private CallbackManager callbackManager;
          private Button loginButton;
  
  
  
      onCreate:
      //Facebook
              callbackManager = CallbackManager.Factory.create();
              loginButton = (Button)findViewById(R.id.login_button);
              loginButton.setOnClickListener(new View.OnClickListener() {
                  public void onClick(View v) {
                      // Perform action on click
                      if(Util.isNetworkConnectedNotify(context, LandingActivity.this)) { loginFacebook();  }
                  }
              });
  
  
  
         @Override
          protected void onActivityResult(int requestCode, int resultCode, Intent data) {
              callbackManager.onActivityResult(requestCode, resultCode, data);
  
          }
  
  
  
     private void loginFacebook() {
  
              List&lt;String&gt; permissionNeeds = Arrays.asList("public_profile", "user_friends", "email");
              LoginManager.getInstance().logInWithReadPermissions(LandingActivity.this, permissionNeeds);
              LoginManager.getInstance().registerCallback(callbackManager, new FacebookCallback&lt;LoginResult&gt;() {
                  @Override
                  public void onSuccess(LoginResult loginResult) {
  
                      fbToken = loginResult.getAccessToken().getToken();
  
                      GraphRequest request = GraphRequest.newMeRequest(loginResult.getAccessToken(),
                              new GraphRequest.GraphJSONObjectCallback() {
                                  @Override
                                  public void onCompleted(JSONObject object, GraphResponse response) {
  
                                      if (response.getError() != null) {
                                          // handle error
                                          System.out.println("ERROR");
                                          if (dialog != null) dialog.dismiss();
                                          Dialogs.errorDialog(LandingActivity.this);
  
                                      } else {
                                          System.out.println("Success");
                                          try {
                                              String jsonresult = String.valueOf(object);
                                              System.out.println("JSON Result" + jsonresult);
  
                                              fbEmail = object.getString("email");
                                              fbId = object.getString("id");
                                              fbName = object.getString("name");
                                              fbGender = object.getString("gender");
  
  
                                              //Do Login -&gt;&gt;&gt;
                                              &lt;&lt; CALL MY API TO DO USER LOGIN &gt;&gt;
  
                                          } catch (JSONException e) {
                                              e.printStackTrace();
                                          }
                                      }
                                  }
                              });
  
  
                      Bundle parameters = new Bundle();
                      parameters.putString("fields", "id,name,email,gender, birthday");
                      request.setParameters(parameters);
                      request.executeAsync();
                  }
  
                  @Override
                  public void onCancel() {
                      if (dialog != null) dialog.dismiss();
                  }
  
                  @Override
                  public void onError(FacebookException e) {
                      if (dialog != null) dialog.dismiss();
                  }
              });
  
  
      }//end loginFacebook
  
  
  //LifeCycles
  /** Called when leaving the activity */
  @Override
  public void onPause() {
      super.onPause();
      // Logs 'app deactivate' App Event.
      AppEventsLogger.deactivateApp(this);
  }
  
  /** Called when returning to the activity */
  @Override
  public void onResume() {
      super.onResume();
  
      // Logs 'install' and 'app activate' App Events.
      AppEventsLogger.activateApp(this);
  }
  </code></pre>