title: Get value from DialogFragment
body: <p>I want the <code>DialogFragment</code> to return a value to me that was entered in <code>editQuantity</code> when dismissed. </p>
  
  <p>But i am not getting any way to make it work. I can do this by passing the value through the <code>intent</code> but that destroys the progress of the current activity. </p>
  
  <p>Is there any way other than passing through <code>intent</code> that will return me value?</p>
  
  <pre><code>package com.example.myprojectname;
  
  import android.app.AlertDialog;
  import android.app.Dialog;
  import android.content.DialogInterface;
  import android.content.Intent;
  import android.content.DialogInterface.OnClickListener;
  import android.os.Bundle;
  import android.support.v4.app.DialogFragment;
  import android.text.InputType;
  import android.util.Log;
  import android.widget.EditText;
  
  public class QuantityDialogFragment extends DialogFragment implements OnClickListener { 
  
  
      private EditText editQuantity;
  
      @Override
      public Dialog onCreateDialog(Bundle savedInstanceState) {
          editQuantity = new EditText(getActivity());
          editQuantity.setInputType(InputType.TYPE_CLASS_NUMBER);
  
          return new AlertDialog.Builder(getActivity())
          .setTitle(R.string.app_name)
          .setMessage("Please Enter Quantity")
          .setPositiveButton("OK", this)
          .setNegativeButton("CANCEL", null)
          .setView(editQuantity)
          .create();
  
      }
  
      @Override
      public void onClick(DialogInterface dialog, int position) {
          String value = editQuantity.getText().toString();
          Log.d("Quantity: ", value);
          dialog.dismiss();       
      }
  }
  </code></pre>