title: Making a Facebook login button android app page
body: <p>I am making a facebook login page android app, just with login button. In my this example after login the cancel method runs instead of onSccess. </p>
  
  <p>Here is my code..</p>
  
  <pre><code>public class MainActivity extends FragmentActivity {
   private TextView info;
   private LoginButton loginButton;
   private CallbackManager callbackManager;
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      FacebookSdk.sdkInitialize(getApplicationContext());
      callbackManager = CallbackManager.Factory.create();
      setContentView(R.layout.activity_main);
     info = (TextView)findViewById(R.id.info);
      loginButton = (LoginButton) findViewById(R.id.login_button);
  
  
      loginButton.registerCallback(callbackManager, new FacebookCallback&lt;LoginResult&gt;() {
          @Override
          public void onSuccess(LoginResult loginResult) {
              AccessToken access_token = AccessToken.getCurrentAccessToken();
              Profile profile = Profile.getCurrentProfile();
              info.setText("welcome"  +profile.getName());
  
          }
  
          @Override
          public void onCancel() {
              info.setText("Login attempt canceled.");
          }
  
          @Override
          public void onError(FacebookException e) {
              info.setText("Login attempt failed.");
          }
      });
  }
  
  @Override
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
      super.onActivityResult(requestCode, resultCode, data);
      callbackManager.onActivityResult(requestCode, resultCode, data);
  
  
  }
  
  }
  </code></pre>
  
  <p>How can i solve this?</p>