title: Android Facebook LoginButton Callback jumps to canceled
body: <p>I have the following code. It is a simple test of the callback function of the LoginButton in Facebook's Android API. </p>
  
  <pre><code> @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      FacebookSdk.sdkInitialize(getApplicationContext());
      setContentView(R.layout.activity_main);
      callbackManager = CallbackManager.Factory.create();
      LoginButton loginButton = (LoginButton)findViewById(R.id.login_button);
      loginButton.setReadPermissions("user_friends");
      loginButton.setReadPermissions("email");
      loginButton.setReadPermissions("public_profile");
      loginButton.registerCallback(callbackManager, new FacebookCallback&lt;LoginResult&gt;() {
  
          @Override
          public void onSuccess(LoginResult loginResult) {
              Log.e("SUCCESS", "LOGIN SUCCESSFUL");
          }
  
          @Override
          public void onCancel() {
              Log.e("CANCEL", "Cancelled");
          }
  
          @Override
          public void onError(FacebookException e) {
              Log.e("ERROR", "Facebook Exception");
          }
      });
  }
  
  @Override
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
      super.onActivityResult(requestCode, resultCode, data);
      callbackManager.onActivityResult(requestCode, resultCode, data);
  }
  </code></pre>
  
  <p>The only problem is that whenever I click the loginButton, a dialog appears and disappears for a brief moment, and then the logcat prints out the "CANCEL" text. I cannot seem to fix this error, and I'm not clicking cancel, because that dialog simply shows up and immediately disappears.</p>
  
  <p>Please help me fix this?</p>