title: Showing a DialogFragment in a Fragment
body: <p>I'm currently working on converting an Activity into a Fragment. The activity contains a Edittext that when clicked shows a DialogFragmment for picking a date. In the Activity I would simply call this to show the dialog:</p>
  
  <pre><code>@SuppressLint("NewApi")
  public void showDatePickerDialog(View v) {
      DatePickerFragment newFragment = new DatePickerFragment(datePickerEditText);
      newFragment.show(getFragmentManager(), "datePicker");
  }
  </code></pre>
  
  <p>However this doesn't seem to work to show the dialog from a Fragment. I'm getting an error on the "show" method. So to be clear I was wondering how to show a DialogFragment from a Fragment?</p>
  
  <p>This is the code for the DialogFragment</p>
  
  <pre><code>public class DatePickerFragment extends DialogFragment implements DatePickerDialog.OnDateSetListener {
  
  public EditText activity_edittext;
  
  @SuppressLint("ValidFragment")
  public DatePickerFragment(EditText edit_text) {
      activity_edittext = edit_text;
  }
  
  @Override
  public Dialog onCreateDialog(Bundle savedInstanceState) {
      // Use the current date as the default date in the picker
      final Calendar c = Calendar.getInstance();
      int year = c.get(Calendar.YEAR);
      int month = c.get(Calendar.MONTH);
      int day = c.get(Calendar.DAY_OF_MONTH);
  
      return new DatePickerDialog(getActivity(), this, year, month, day);
  }
  
  @Override
  public void onDateSet(DatePicker view, int year, int month, int day) {
      activity_edittext.setText(String.valueOf(day ) + "/" +   String.valueOf(month + 1) + "/" + String.valueOf(year));
  }
  </code></pre>
  
  <p>}</p>