title: Passing data from dialogfragment to fragment
body: <p>I got an activity with three fragments and from one of these fragments i'm calling a MyDialogFragment.show()-method. Dialog appears, I do some text-input and try to pass this text-input back to fragment. So far so good.</p>
  
  <p>I set up the back-communication via the onActivityResult() of the 'parent'-fragment in combination with set/getTargetFragment()-calls (see code below). And I do get that result in my parent-fragment, but i cannot pass some data. Every attemp to create an intent and putting some extra-data in it fails. I don't know if I am blind or such.. but shouldn't I be able to create an intent inside a onClick()-method?!</p>
  
  <p>Any help appreciated!</p>
  
  <p>Inside my dialog-fragment:</p>
  
  <pre><code>public Dialog onCreateDialog(Bundle savedInstanceState) {
      AlertDialog.Builder builder = new AlertDialog.Builder(getParentFragment().getActivity());
      LayoutInflater inflater = getActivity().getLayoutInflater();
      builder.setView(inflater.inflate(R.layout.dialog_choose_title, null));
  
      builder.setTitle(mTitle)
              .setPositiveButton(R.string.dialog_save_title, new DialogInterface.OnClickListener() {
                  @Override
                  public void onClick(DialogInterface dialog, int which) {
                      Intent intent = new Intent(getParentFragment().getActivity(), MyMainClass.class);
                      intent.putExtra("title", mEditText.getText().toString());
                      getTargetFragment().onActivityResult(getTargetRequestCode(), Activity.RESULT_OK, intent);
                      dismiss();
                  }
              })
              .setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
                  @Override
                  public void onClick(DialogInterface dialog, int which) {
                      dismiss();
                  }
              });
      return builder.create();
  }
  </code></pre>
  
  <p>Inside my fragment:</p>
  
  <pre><code>public void onClick(View v) {
              ChooseTitleDialog dialog = ChooseTitleDialog.newInstance(mTimerObject.getmTitle());
              dialog.setTargetFragment(mThis, 42);
              dialog.show(mFragmentMgr, "choose_title_dialog");
          }
  </code></pre>