title: Code for logout from Facebook in android
body: <p>I am using customize Facebook login button .this is my code. I'm using session manager to store email and name for entire app.I have used logout button in third activity .</p>
  
  <p><strong>How to logout from Facebook</strong></p>
  
  <pre><code>public void FB_Login(View view){
  
      callbackManager = CallbackManager.Factory.create();
  
  
      LoginManager.getInstance().logInWithReadPermissions(this, Arrays.asList("public_profile", "email"));
  
         LoginManager.getInstance().registerCallback(callbackManager,
                 new FacebookCallback&lt;LoginResult&gt;() {
                     @Override
                     public void onSuccess(LoginResult loginResult) {
  //                       AccessToken.getCurrentAccessToken().getPermissions();
  //                       Profile profile = Profile.getCurrentProfile();
  //                       String firstName = profile.getFirstName();
  //                       System.out.println(profile.getProfilePictureUri(20,20));
  //                       System.out.println(profile.getLinkUri());
  
                         // App code
                         AccessToken.getCurrentAccessToken().getPermissions();
  
                         GraphRequest request = GraphRequest.newMeRequest(
                                 loginResult.getAccessToken(),
  
                                 new GraphRequest.GraphJSONObjectCallback() {
                                     @Override
                                     public void onCompleted(
                                             JSONObject object,
                                             GraphResponse response) {
                                         // Application code
                                         try {
                                             email = object.getString("email");
  
                                             name=object.getString("name");
  
  // Creating user login session
                                             // For testing i am stroing name, email as follow
                                             // Use user real data
                                             session.createLoginSession(name, email);
  
                                             // Staring MainActivity
                                              if (session.isLoggedIn()) {
                                                  in = new Intent(HomePageActivity.this, HomeSearchActivity.class);
                                                  in.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
  
                                                  // Add new Flag to start new Activity
                                                  in.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                                                  startActivity(in);
  
                                                  finish();
  
                                              }
                                         } catch (JSONException e) {
                                             e.printStackTrace();
                                         }
                                         Log.v("LoginActivity", response.toString());
                                     }
                                 });
                         Bundle parameters = new Bundle();
                         parameters.putString("fields", "id,name,email,gender, birthday");
                         request.setParameters(parameters);
                         request.executeAsync();
  
                     }
  
                     @Override
                     public void onCancel() {
                         // App code
                         Log.v("LoginActivity", "cancel");
                     }
  
                     @Override
                     public void onError(FacebookException exception) {
                         // App code
                         Log.v("LoginActivity", exception.getCause().toString());
                     }
                 });
  
  
  }
  </code></pre>
  
  <p>Anyone help me. please.</p>