title: Android Datepicker Fragment - How to do something when the user sets a date?
body: <p>I'm following the tutorial here:
  <a href="http://developer.android.com/guide/topics/ui/controls/pickers.html" rel="nofollow noreferrer">http://developer.android.com/guide/topics/ui/controls/pickers.html</a></p>
  
  <p>I got things to work and the datepicker shows up.  However, I am stuck on how to act on when the user sets the date.</p>
  
  <p>I see they have this method: </p>
  
  <pre><code>public void onDateSet(DatePicker view, int year, int month, int day) {
      // Do something with the date chosen by the user
  }
  </code></pre>
  
  <p>But that does nothing if I put any code in it.</p>
  
  <p>I'm not that familiar with Java so I'm not sure what additional code is needed in order to update a textview with the chosen date.</p>
  
  <p>I did add this code:</p>
  
  <pre><code>private DatePickerDialog.OnDateSetListener mDateListener =
          new DatePickerDialog.OnDateSetListener() {
              public void onDateSet(DatePicker view, int year, int month, int day) {
                  updateDate(year, month, day);
              }
          };
  
  public void updateDate(int year, int month, int day) {
      TextView bdate = (TextView)findViewById(R.id.birthDate);
      Date chosenDate = new Date(year, month, day);
      java.text.DateFormat dateFormat = DateFormat.getDateFormat(getApplicationContext());
      bdate.setText(dateFormat.format(chosenDate));
  }
  </code></pre>
  
  <p>But that does nothing.</p>
  
  <p>I did find this almost exact question:
  <a href="https://stackoverflow.com/questions/11527051/get-date-from-datepicker-using-dialogfragment">Get date from datepicker using dialogfragment</a></p>
  
  <p>However in that solution wouldn't using (EditSessionActivity) limit the DatePickerFragment class to working with only the EditSessionActivity?</p>