title: Android Facebook setFragment with a regular Fragment
body: <p>Because setFragment of Facebook is working only with support.fragment, I did the following in order to overcome this when working with regular fragment:</p>
  
  <pre><code>public class NativeFragmentWrapper extends android.support.v4.app.Fragment {
      private final Fragment nativeFragment;
  
      public NativeFragmentWrapper(Fragment nativeFragment) {
          this.nativeFragment = nativeFragment;
      }
  
      @Override
      public void startActivityForResult(Intent intent, int requestCode) {
          nativeFragment.startActivityForResult(intent, requestCode);
      }
  
      @Override
      public void onActivityResult(final int requestCode, final int resultCode, final Intent data) {
          nativeFragment.onActivityResult(requestCode, resultCode, data);
      }
  }
  </code></pre>
  
  <p>and in the login page where facebook button resides, I did the following:</p>
  
  <pre><code>authButton.setFragment(new new NativeFragmentWrapper(this));
  </code></pre>
  
  <p>in Eclipse it worked great but Android Studio 1.0.2 is complaining:</p>
  
  <p>This fragment should provide a default constructor (a public constructor with no arguments). From the Fragment documentation: Every fragment must have an empty constructor, so it can be instantiated when restoring its activity's state. It is strongly recommended that subclasses do not have other constructors with parameters, since these constructors will not be called when the fragment is re-instantiated; instead, arguments can be supplied by the caller with setArguments(Bundle) and later retrieved by the Fragment with getArguments().</p>
  
  <p>So I tried this:</p>
  
  <pre><code>NativeFragmentWrapper f = new NativeFragmentWrapper();
  Bundle bundle = new Bundle();
  f.setArguments(bundle);
  authButton.setFragment(f);
  </code></pre>
  
  <p>but I didn't find a way to put "this" (which is a Fragment) inside the bundle in order to retrieve it in the wrapper constructor.</p>
  
  <p>I can @SuppressLint("ValidFragment") but I'm sure there is a cleaner way to do it.</p>