title: Android: DatePicker and DatePicker Dialog
body: <p>I have this code here on the options menu </p>
  
  <pre><code>Dialog dialog = new Dialog(ScheduleActivity.this);
  dialog.setTitle("Add Event");
  dialog.setContentView(R.layout.add_even_on);
  Button datePicker = (Button) dialog.findViewById(R.id.datePicker);
  final DialogFragment dateFrag = new MyDatePicker();
      datePicker.setOnClickListener(new OnClickListener() {
  
              public void onClick(View v) {
                  dateFrag.show(getSupportFragmentManager(), "datePicker");               
              }
          });
  dialog.show();
  </code></pre>
  
  <p>when, say "Add Event" on the option menu is clicked, a Dialog appears, with a button that shows a <strong>DatePickerDialog</strong> and beside it is a <strong>TextView</strong> that reflects the date chosen in the <strong>DatePickerDialog</strong>, here is the class I got from Androids Developer on how to use the DatePickerDialog. </p>
  
  <pre><code>class MyDatePicker extends DialogFragment implements DatePickerDialog.OnDateSetListener {
   int pYear;
   int pDay;
   int pMonth;
  
  @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);
    }
  
    public void onDateSet(DatePicker view, int year, int month, int day) {
      pYear = year;
      pDay = day;
      pMonth = month;
    }
  }
  </code></pre>
  
  <p>So my problem is that how do i get the Value in milleseconds when i click "Set" on the DatePickerDialog which in turn automatically closes it, and returns to my Dialog which contains the button which open the DatePickerDialog and a Textview which reflects watever date is chosen the DatePickerDialog... i wont show the one i chose inside the DatePickerDialog...  </p>
  
  <p>Here is a picture of what i mean,</p>
  
  <p>So when i click on the Pick Date Button a DatePickerDialog box appears as seen on the next picture
  <img src="https://i.stack.imgur.com/lphbs.png" alt="enter image description here"> </p>
  
  <p><img src="https://i.stack.imgur.com/KYtFW.png" alt="enter image description here"></p>
  
  <p>and when i click set, i wanted to take into account the value in millseconds from that DatePickerDialog</p>