title: android fragment orientation change
body: <p><strong>EDIT:</strong></p>
  
  <p>I have a <code>DialogFragment</code> where the reference inside the parent <code>Activity</code> is NULL after I change device orientation. How do I fix this?</p>
  
  <p>Fragment creation:</p>
  
  <pre><code>MyFragment myFragment = MyFragment.newInstance(title);
  myFragment.show(getFragmentManager(), tag);
  </code></pre>
  
  <p>After orientation change:</p>
  
  <pre><code>MyFragment myFragment = (MyFragment)getFragmentManager().findFragmentByTag(tag);
  myFragment.dismiss();  //NULL pointer exception here
  </code></pre>