title: Opening Facebook login Dialog on Button Click
body: <p>Hi Everyone I am intergrating facebook login to my app. I have searched a lot and I am able to login I have used this link:  <a href="https://developers.facebook.com/docs/mobile/android/build/#register" rel="nofollow">https://developers.facebook.com/docs/mobile/android/build/#register</a><br>
  All I want to do is that When I click on a Button then facebook dialog must appear intead of just opening the activity (HomeActivity) following is my code.</p>
  
  <pre><code>    public class HomeActivity extends Activity {
  
       Facebook facebook = new Facebook("114987225319269");
  
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_home);
  
          Button more = (Button) findViewById(R.id.button1);
          more.setOnClickListener(new View.OnClickListener() {
              public void onClick(View view) {
  
                  facebook.authorize(this, new DialogListener() {
                      @Override
                      public void onComplete(Bundle values) {}
  
                      @Override
                      public void onFacebookError(FacebookError error) {}
  
                      @Override
                      public void onError(DialogError e) {}
  
                      @Override
                      public void onCancel() {}
                  });
              }
  public void onActivityResult(int requestCode, int resultCode, Intent data) {
                  super.onActivityResult(requestCode, resultCode, data);
  
                  facebook.authorizeCallback(requestCode, resultCode, data);
              }
  
          }); 
  
      }   
  
      @Override
      public boolean onCreateOptionsMenu(Menu menu) {
          getMenuInflater().inflate(R.menu.activity_home, menu);
          return true;
      }
  }
  </code></pre>