title: Pass intent to my fragment
body: <p>I have implemented the <strong>NFC foreground dispatch</strong> in my <strong>Activity</strong>. The code works fine, when the NFC tag get close to my phone, the <code>onNewIntent(Intent intent)</code> is called. </p>
  
  <p>Now, I would like to show an <strong>Fragment</strong>(MyFragment.java) when the <code>onNewIntent(Intent intent)</code> is invoked. There is <code>resolveIntent(Intent intent)</code> method defined in the <strong>Fragment</strong> class.</p>
  
  <p>Here is some code of my <strong>Activity</strong>:</p>
  
  <pre><code>public class MainActivity extends Activity{
     …
     @Override
     public void onNewIntent(Intent intent) {
      super.onNewIntent(intent);
  
        FragmentManager fragmentManager = activity.getFragmentManager();
       FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
  
        //How to pass the 'intent' to MyFragment?
        MyFragment fragment = new MyFragment();
  
      fragmentTransaction.replace(R.id.placeholder, fragment, fragmentName);
      fragmentTransaction.addToBackStack(null);
      fragmentTransaction.commit();
     }        
  }
  </code></pre>
  
  <p>Code of <strong>MyFragment.java</strong></p>
  
  <pre><code>public class MyFragment extends Fragment{
      …
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState){
         ...
      }
      @Override
      public void onResume(){
        super.onResume();
  
         //How to get 'intent' here 
         resolveIntent(intent);
      }
  
      private void resolveIntent(Intent intent){
         ...
      }
  }
  </code></pre>
  
  <p>My question is how could I pass the <code>intent</code> from <code>onNewIntent(Intent intent)</code> to <strong>MyFragment</strong> so that I can handle the intent in <strong>MyFragment</strong> in <code>onResume()</code>?</p>