title: error in using android-facebook-sdk
body: <p>I am just not able to figure out the problem in my code<Br>
  I want to login with FaceBook for my app<br>
  I have followed a tutorial from a youtube video.<br>
  in the code , I am able to login using facebook, but I am not able to implement the logout functionality.
  i tried doing it. (the code for logging out is also there but still its not working)
  the code is as follows:</p>
  
  <p>after i click on login button:</p>
  
  <pre><code>    public void onClick(View v) {
      // TODO Auto-generated method stub
  
      switch(v.getId()){
  case R.id.fb_button:
  
      try{
  
           //to check if already logged in.
           //my code never enters the following block.
  
      if(fb.isSessionValid()){
          Toast.makeText(getBaseContext(), "loging out",     Toast.LENGTH_LONG).show();
  
          try {
              fb.logout(getBaseContext());
                           // update_fb_buttonimage() is a function to change the image of button
                            //if logged in: it shows logout
                            // else it shows login.
  
                            //but somehow its not working
              update_fb_buttonimage();
          } catch (MalformedURLException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
          } catch (IOException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
          }
  
      }
  
                //following is working fine.
                // but every time i click n the button, it enters this bolok of code.
                //which is not what i want. this is tobe executed only if user is not logged in
                //even if  user is logged in , program enters this code only.
                // instead of this th above "if" block should be executed.
  
      else{
          Toast.makeText(getBaseContext(), "logging in", Toast.LENGTH_LONG).show();
  
  
          fb.authorize(LoginPage.this,new DialogListener(){
  
              @Override
              public void onComplete(Bundle values) {
                  // TODO Auto-generated method stub
                  update_fb_buttonimage();
  
              }
  
              @Override
              public void onFacebookError(FacebookError e) {
                  // TODO Auto-generated method stub
  
                  Toast.makeText(getBaseContext(), "You can't login to the facebook", Toast.LENGTH_LONG).show();
              }
  
              @Override
              public void onError(DialogError e) {
                  // TODO Auto-generated method stub
                  Toast.makeText(getBaseContext(), "unIdentified Error", Toast.LENGTH_LONG).show();   
              }
  
              @Override
              public void onCancel() {
                  // TODO Auto-generated method stub
  
                  Toast.makeText(getBaseContext(), "onCancel", Toast.LENGTH_LONG).show();
              }} );
      }   }catch(Exception e){
          System.out.print(e.toString());
          Toast.makeText(getBaseContext(), e.toString(), Toast.LENGTH_LONG).show();
      }
          break;
        }
  </code></pre>
  
  <p>Where is my error?</p>