title: Returning data from a DialogFragment to an Adapter
body: <p>I'm trying to use an interface to return data from a <code>DialogFragment</code> to the <code>ArrayAdapter</code> from which it's shown.</p>
  
  <p>I've read something similar <a href="https://stackoverflow.com/a/14025009/326849">here</a>, but I don't know how to call in the <code>DialogFragment</code> the function returning the data.</p>
  
  <p>Anybody can help?</p>
  
  <p><b>MyDialog.java</b></p>
  
  <pre><code>public class MyDialog extends DialogFragment {  
  
      static interface Listener {
          void returnData(int result);
      }
  
      /* ... */
  
      @Override
      public void onActivityCreated (Bundle savedInstanceState){
          super.onActivityCreated(savedInstanceState);        
  
          mBtnSubmit.setOnClickListener(new OnClickListener() {
              @Override
              public void onClick(View v) {
  
                  // How can I call PCListAdapter.returnData ?
  
                  dismiss();              
              }
          });
      }
  
  }
  </code></pre>
  
  <p><b>PCListAdapter.java</b></p>
  
  <pre><code>public class PCListAdapter extends ArrayAdapter&lt;PC&gt; implements MyDialog.Listener {
  
      /* ... */
  
      public void showCommentDialog() {
  
          FragmentManager fm = ((Activity)mContext).getFragmentManager();
          MyDialog dialog = new MyDialog();
          dialog.show(fm, "mydialog");
      }
  
      @Override
      public void returnData(int result) {
      }
  }
  </code></pre>