title: How do I use onDateSet from another class in Java?
body: <p>I have two ImageButtons. One is responsible for setting a beginning date, and the other is responsible for setting the end date. When each one is pressed they display a DatePickerDialog. The onCreateDialog method is within another class. Here is that class:</p>
  
  <p><strong>DatePickerFragment.Java</strong></p>
  
  <pre><code>package com.ThatOneNoob.smarthaul;
  
  import java.util.Calendar;
  
  import android.app.DatePickerDialog;
  import android.app.Dialog;
  import android.app.DialogFragment;
  import android.os.Bundle;
  import android.widget.DatePicker;
  
  
  public class DatePickerFragment extends DialogFragment implements DatePickerDialog.OnDateSetListener {
  
  @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);
  
  
      // Create a new instance of DatePickerDialog and return it
      return new DatePickerDialog(getActivity(), this, year, month, day);
  }
  
  
  @Override
  public void onDateSet(DatePicker v, int year, int month, int day) {
      // TODO Auto-generated method stub
  
      switch (v.getId()){
  
      case R.id.datesel1:
          toDate.setText(new StringBuffer());
      }
   }
  
  
  }
  </code></pre>
  
  <p>Obviously incomplete, toDate is one of the TextViews it is suppose to manage. datesel1 is the ImageButton. It will append the TextView to include the set date in a 01/02/2013 format. I cannot declare a TextView as a static so I can't call it within this class. So, should I make the onDateSet invoke a static method that will set the TextView to what it needs to do? Or what should I do?</p>