title: Not able to relogin facebook after logging out
body: <p>I integrated facebook login to my Android App. I was able to login when I launch the Application, but when I logout and come back to initial screen to login again ,it does not login I was taken to Home screen of mobile . But when I relaunch the app again from launcher and try to login, I am able to login.But with in the App , when I try to relogin it does not login.
  <br> For information , I used custom button to login into facebook. <br></p>
  
  <p>The below is the code : <br></p>
  
  <p><strong>Fragment and OnCreate() Method <br></strong></p>
  
  <pre><code>  public class SocialFragment extends Fragment implements View.OnClickListener {
  
   private AccessTokenTracker accessTokenTracker;
   private ProfileTracker profileTracker;
   private CallbackManager callbackManager;
  
  
   @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
              initializeFaceBook();
  
      }
  </code></pre>
  
  <p><strong>//Initilization of Facebook SDK</strong></p>
  
  <pre><code> private void initializeFaceBook(){
          Log.d(TAG,"initializeFacebook.......");
          FacebookSdk.sdkInitialize(getActivity().getApplicationContext());
  
          callbackManager = CallbackManager.Factory.create();
  
        accessTokenTracker= new AccessTokenTracker() {
              @Override
              protected void onCurrentAccessTokenChanged(AccessToken oldToken, AccessToken newToken) {
                   Log.d(TAG,"onCurrentAccessTokenChanged()");
              }
          };
  
          profileTracker = new ProfileTracker() {
              @Override
              protected void onCurrentProfileChanged(Profile oldProfile, Profile newProfile) {
                  //displayMessage(newProfile);
                  Log.d(TAG,"onCurrentProfileChanged()");
              }
          };
  
          accessTokenTracker.startTracking();
          profileTracker.startTracking();
      }
  </code></pre>
  
  <p><strong>//Custom Button Click to login Facebook</strong></p>
  
  <pre><code>private void fbLogin(){
          LoginManager.getInstance().logInWithReadPermissions(this, Arrays.asList("public_profile", "user_friends"));
      }
  </code></pre>
  
  <p><strong>//OnCreateView() method that contains Layout</strong></p>
  
  <pre><code>public View onCreateView(LayoutInflater inflater, ViewGroup container,
                               Bundle savedInstanceState) {
          // Inflate the layout for this fragment
          View view =  inflater.inflate(R.layout.fragment_social, container, false);
          mContainerId = container.getId();
  
          ImageButton fBook = (ImageButton)view.findViewById(R.id.fbook);
          fBook.setOnClickListener(this);
  
          return view;
      }
  </code></pre>
  
  <p><strong>//OnClickMethod()</strong></p>
  
  <pre><code>@Override
      public void onClick(View v) {
          switch (v.getId()){
  
              case R.id.fbook:
                   fbLogin();
                  //onFblogin();
                  break;
  
  
          }
      }
  </code></pre>
  
  <p><strong>//OnActivityResult</strong></p>
  
  <pre><code> @Override
      public void onActivityResult(int requestCode, int resultCode, Intent data) {
          super.onActivityResult(requestCode, resultCode, data);
          callbackManager.onActivityResult(requestCode, resultCode, data);
      }
  </code></pre>
  
  <p><strong>//On Destroy</strong></p>
  
  <pre><code>@Override
      public void onDestroy() {
          super.onDestroy();
          Log.d(TAG, "In onDestroy().........");
          profileTracker.stopTracking();
          accessTokenTracker.stopTracking();
      }
  </code></pre>
  
  <p><strong>//Launch New Fragment</strong></p>
  
  <pre><code>private void displayMessage(Profile profile){
          if(profile != null){
              Log.d("PROFILE", profile.getName());
              Toast.makeText(getActivity(), "Facebook Profile Name:::" + profile.getName(), Toast.LENGTH_LONG).show();
                      getFragmentManager().beginTransaction().replace(mContainerId,new BikePoolerMapFragment()).commit();
          }
      }
  </code></pre>
  
  <p><strong>//OnResume()</strong></p>
  
  <pre><code> @Override
      public void onResume() {
          super.onResume();
          Profile profile = Profile.getCurrentProfile();
          displayMessage(profile);
      }
  }
  </code></pre>
  
  <p><strong>Logout used in another Fragment:</strong></p>
  
  <pre><code>LoginManager.getInstance().logOut();
  </code></pre>
  
  <p>Can anyone help me is relogin the facebook with in app. 
  Is there a way in which to logout facebook other than the way I used.</p>
  
  <p><strong>Facebook SDK used : 4.8.2
  Android Studio is used</strong></p>