title: User login using facebook Facebook login API
body: <p>I have developed an app that uses Facebook login for user to login into the app.However i have to uninstall Facebook for android for it to work.Any assistance?
  Below is the code.</p>
  
  <pre><code>public class MokoActivity extends Activity implements OnClickListener{
      TextView create_account;
      EditText name;
  
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.main);
          create_account=(TextView)findViewById(R.id.textView_createAccount);
          name=(EditText)findViewById(R.id.editText_name);
          create_account.setOnClickListener(this);
      }
  
      public void onClick(View v) {
          // TODO Auto-generated method stub
          switch(v.getId()){
          case R.id.textView_createAccount:
                  String user_name=name.getText().toString();
                  if(user_name.length()&lt;4){
                      Toast toast=Toast.makeText(MokoActivity.this,"Invalid Name",Toast.LENGTH_LONG);
                      toast.show();
                  }
  
                  else{
              Session.openActiveSession(this, true,new Session.StatusCallback(){
                  public void call(Session session,SessionState state,Exception exception){
                      if(state.isOpened()){
                          Intent intent=new Intent(MokoActivity.this,HomeActivity.class);
                          intent.putExtra("username",name.getText().toString());
                          startActivity(intent);
                      }
                  }
              });
              }
              break;
          }
      }
  
      @Override
        public void onActivityResult(int requestCode, int resultCode, Intent data) {
            super.onActivityResult(requestCode, resultCode, data);
            Session.getActiveSession().onActivityResult(this, requestCode, resultCode, data);
        }
  }
  </code></pre>
  
  <p>It works fine only that if facebook for android is installed,it doesnt redirect to HomeActivity intent after login.I have to uninstall facebook for android in order for it to function.</p>