title: facebook login button setfragment error
body: <p>I am trying to setup a login with facebook into my app. I have one main activity and a couple of fragments. Using facebook sdk 3.5.2 i did everithing by facebook officaial <a href="https://developers.facebook.com/docs/android/login-with-facebook/" rel="noreferrer">tutorial</a> but when i add this line <code>authButton.setFragment(this);</code> it gives me an error that my fragment is not a fragment. </p>
  
  <blockquote>
    <p>(The method setFragment(Fragment) in the type LoginButton is not
    applicable for the arguments (FaceobookLoginFragment))</p>
  </blockquote>
  
  <p>I am adding fragments from main class to action bar like this</p>
  
  <pre><code>ActionBar bar = getActionBar();
  
  bar.setDisplayShowHomeEnabled(false);
  
  bar.setDisplayShowTitleEnabled(false);
  
  bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
  
  String FloginTitle = "Flogin";
  ActionBar.Tab FloginTab = bar.newTab();
  FloginTab.setText(FloginTitle);
  FloginTab.setTabListener(new TabListener(this, FloginTitle, FaceobookLoginFragment.class));
  bar.addTab(FloginTab);
  </code></pre>
  
  <p>And this is the listener</p>
  
  <pre><code>public class TabListener implements ActionBar.TabListener{
  
  private final FragmentActivity fActivity;
  private final String ftag;
  private final Class fragmentClass;
  private Fragment fragment;
  
  
  public TabListener(FragmentActivity activity, String tag, Class fragmentClass ) {
      this.fActivity = activity;
      this.ftag = tag;
      this.fragmentClass = fragmentClass;
  
      this.fragment = activity.getFragmentManager().findFragmentByTag(tag);
  
  }
  
  @Override
  public void onTabReselected(Tab tab, android.app.FragmentTransaction ft) {
      // TODO Auto-generated method stub
  
  }
  
  @Override
  public void onTabSelected(Tab tab, android.app.FragmentTransaction ft) {
      if (fragment == null) {
          // instantiate a new fragment for the given class
          fragment = Fragment.instantiate(fActivity, fragmentClass.getName());
          // place in the default root viewgroup - android.R.id.content
          ft.replace(android.R.id.content, fragment, ftag);
      } else {
          if (fragment.isDetached())
              ft.attach(fragment);
      }
  
  }
  
  @Override
  public void onTabUnselected(Tab tab, android.app.FragmentTransaction ft) {
      if (fragment != null) {
          ft.detach(fragment);
      }       
  }
  </code></pre>
  
  <p>And Facebook Fragment</p>
  
  <pre><code>public class FaceobookLoginFragment extends Fragment {
  
  private static final String TAG = "FBLOGINFRAGMENT";
  
  private UiLifecycleHelper uiHelper;
  
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      uiHelper = new UiLifecycleHelper(getActivity(), callback);
      uiHelper.onCreate(savedInstanceState);
  }
  
  @Override
  public void onActivityCreated(Bundle savedInstanceState) {
      super.onActivityCreated(savedInstanceState);
  
  }
  
  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
      View view = inflater.inflate(R.layout.facebook_login_layout, container, false);
      LoginButton authButton = (LoginButton) view.findViewById(R.id.authButton);
      authButton.setFragment(new FaceobookLoginFragment());
      return view;
  }
  
  private void onSessionStateChange(Session session, SessionState state, Exception exception) {
      if (state.isOpened()) {
          Log.i(TAG , "Logged in...");
      } else if (state.isClosed()) {
          Log.i(TAG, "Logged out...");
      }
  }
  
  private Session.StatusCallback callback = new Session.StatusCallback() {
      @Override
      public void call(Session session, SessionState state, Exception exception) {
          onSessionStateChange(session, state, exception);
      }
  };
  
  @Override
  public void onResume() {
      super.onResume();
      uiHelper.onResume();
  }
  
  @Override
  public void onActivityResult(int requestCode, int resultCode, Intent data) {
      super.onActivityResult(requestCode, resultCode, data);
      uiHelper.onActivityResult(requestCode, resultCode, data);
  }
  
  @Override
  public void onPause() {
      super.onPause();
      uiHelper.onPause();
  }
  
  @Override
  public void onDestroy() {
      super.onDestroy();
      uiHelper.onDestroy();
  }
  
  @Override
  public void onSaveInstanceState(Bundle outState) {
      super.onSaveInstanceState(outState);
      uiHelper.onSaveInstanceState(outState);
  }
  
  // prints a hashkey for facebook app data
  public void printHashKey() {
  
      try {
          PackageInfo info = getActivity().getPackageManager().getPackageInfo("com.mio.discounthunter", PackageManager.GET_SIGNATURES);
          for (Signature signature : info.signatures) {
              MessageDigest md = MessageDigest.getInstance("SHA");
              md.update(signature.toByteArray());
              Log.d("TEMPTAGHASH KEY:", Base64.encodeToString(md.digest(), Base64.DEFAULT));
          }
      } catch (NameNotFoundException e) {
  
      } catch (NoSuchAlgorithmException e) {
  
      }
  
  }
  </code></pre>
  
  <p><strong>UPDATE</strong>: found out why.. facebook sdk only works with android support library so the solution is to use import android.support.v4.app.* all over my app and re factor everything that involves support library...</p>