title: Communication between Fragment and DialogFragment
body: <p>I'm trying to make a <code>Fragment</code> to show a <code>Dialog</code> using <a href="http://developer.android.com/reference/android/app/DialogFragment.html"><code>DialogFragment</code> API</a>.</p>
  
  <p>My dialog only has an <code>EditText</code> view and I want to pass the string wrote on it back to the <code>Fragment</code>.</p>
  
  <p>I'm able to show the dialog from the <code>Fragment</code>, but I'm not able to retrieve the string from the input field back to my <code>Fragment</code>.</p>
  
  <p>I tried both ways to create a dialog: overwriting the <code>DialogFragment.onCreateView</code> method and writing the entire dialog's view and overwriting the <code>DialogFragment.onCreateDialog</code> and using the <code>AlertDialog.Builder</code> to make it easier to write the buttons behavior. </p>
  
  <p>The Android documentation about dialogs <a href="http://developer.android.com/guide/topics/ui/dialogs.html#PassingEvents">passing events back to dialog's host</a> is about host being always an <code>Activity</code> and never a <code>Fragment</code>. I tried to generalize the behavior for use it on my case, but I cannot.</p>
  
  <p>I tried using the <code>DialogFragment.onAttach</code> callback to get the <code>Activity</code> reference and use an interface between the <code>Fragment</code> and the <code>DialogFrament</code> and it works fine, but I cannot retrieve the <code>Fragment</code> from the <code>Activity</code> to make it work.</p>
  
  <p>Can anybody help with a brief example? </p>
  
  <p>Thanks in advance</p>