title: How to make a DatePicker with DialogFragment and FragmentManager?
body: <p>So I have been at this for a while, and I cannot seem to figure it out. I am fairly new at Android development, so bear with me please. I wasn't too familiar with creating a Datepicker and I learned to do it the deprecated way just to get the hang of it. Used this tutorial to get me up to speed:</p>
  
  <p><a href="http://developer.android.com/resources/tutorials/views/hello-datepicker.html" rel="nofollow">http://developer.android.com/resources/tutorials/views/hello-datepicker.html</a></p>
  
  <p>But now I need to change it, mainly to not use deprecated code, so I looked all around, and I found 2 tutorials, mainly this one though:</p>
  
  <p><a href="http://www.kylebeal.com/2011/11/android-datepickerdialog-and-the-dialogfragment/" rel="nofollow">http://www.kylebeal.com/2011/11/android-datepickerdialog-and-the-dialogfragment/</a></p>
  
  <p>Problem is, there is code that does not make sense. Mainly this part:</p>
  
  <pre><code>//create new DateDialogFragment
  DateDialogFragment ddf = DateDialogFragment.newInstance(this, R.string.set_date, date);
  
  ddf.setDateDialogFragmentListener(new DateDialogFragmentListener() {
  
      @Override
      public void dateDialogFragmentDateSet(Calendar date) {
          // update the fragment
          mDateDetailFragment.updateDate(date);
      }
  });
  
  ddf.show(getSupportFragmentManager(), "date picker dialog fragment");
  </code></pre>
  
  <p>That is suppose to be what is running in the activity class that it runs in. So I kind of get whats happening throughout the rest of the code, and feel free to look at the rest as it will probably help. The code is essentially following almost the same route as the original <code>showDialog()</code> code. Implementing <code>DatePickerDialog.onDateSetListener</code>, and returning a new <code>DatePickerDialog</code>, with the obvious exception thats its using a DialogFragment. But that is where I have gotten lost. </p>
  
  <p>Part of the reason is because I am not really sure <strong>where</strong> <code>onCreateDialog()</code> returns that new DatePickerDialog. If you look at the code I said does not make sense, both <code>mDateDetailFragment</code> and <code>getSupportFragmentManager()</code> were never instantiated or appeared anywhere else, so I cannot get the tutorial code to even work. The Android Doc also mentions that instead of using <code>showDialog()</code> I should be using both <code>DialogFragment</code> and <code>FragmentManager</code>, which is also not done here. Only DialogFragment.</p>
  
  <p>So like the title, how exactly can I make a DatPicker in the non-depracted form? I would please ask to <strong>NOT</strong> send me to a link and just say look here. I have done that. Believe me. If not, at least explain what I have missed that makes this make sense. Also, if anyone can actually tell me where the <code>onCreateDialog()</code> method sends the <code>DatePickerDialog</code>, that would be extremely helpful as well. I am just trying to make sense of all this, rather than copy and paste code (not that it works anyways). Thanks a lot for taking the time out to read this, and if any clarifications needed, please ask.</p>