title: How to make generalize dateFragment class for multiple Date controls?
body: <p>I want to make generalize/common class call for multiple controls such as a From &amp; To date dialog boxes
  should use same class while call  </p>
  
  <p>here i have two labels lblSrchFrmDate &amp; lblSrchToDate want to show date dialog for both</p>
  
  <p><strong>do i need to create DatePickerFragment for each call?</strong></p>
  
  <p>here is my code 
  <strong>DatePickerFragment.java</strong> class will have</p>
  
  <pre><code>public class DatePickerFragment extends DialogFragment implements DatePickerDialog.OnDateSetListener {
  
  String formattedDt = null;
  public Dialog onCreateDialog(View v) {
      // 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);
  }
  
  public void onDateSet(DatePicker view, int selectedYear, int selectedMonth, int selectedDay) {              
      formattedDt = DateUtil.setSelectedDateInSDF(selectedYear, selectedMonth, selectedDay);              
      //lblSrchFrmDate .setText(formattedDt);&lt;--- want to set selected date on label 
  }
  </code></pre>
  
  <p>}</p>
  
  <p>Code for onClick</p>
  
  <pre><code>// On click Of Label
  @Override
  public void onClick(View v) {
  
      switch (v.getId()) {        
      case R.id.lblSrchFrmDate:
          showDatePickerDialog(v);
          break;
      case R.id.lblSrchToDate:            
          showDatePickerDialog(v);
          break;
      }
  }
  
  public void showDatePickerDialog(View v) {
      DialogFragment newFragment = new DatePickerFragment();
      newFragment.show(getFragmentManager(), "datePicker");
  }
  </code></pre>
  
  <p>how to set date for respective dialogbox call control using View v?
  v.getId() gives me numeric id which shows me value id/datePicker which is not label id </p>