title: How to Use Date Picker in Android Fragment?
body: <p>I have used <code>Date Picker</code> in <code>Activity</code> but I don't know how to use it in Fragment. I am Uploading my activity <code>Date Picker</code> Code. can anyone help me to convert that code in fragment?   </p>
  
  <pre><code>protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
      initialize();
      context = getApplicationContext();
      View.OnClickListener listenerDate = new View.OnClickListener() {
          @Override
          public void onClick(View arg0) {
              final Calendar c = Calendar.getInstance();
              year = c.get(Calendar.YEAR);
              month = c.get(Calendar.MONTH);
              day = c.get(Calendar.DAY_OF_MONTH);
              showDialog(DATE_DIALOG_ID);
          }
      };
      editTextDate.setOnClickListener(listenerDate);
  } private void initialize() {
      editTextDate = (EditText) findViewById(R.id.editTextDate);
  }private void updateDisplay() {
      currentDate = new StringBuilder().append(day).append(".")
              .append(month + 1).append(".").append(year).toString();
      Log.i("DATE", currentDate);
  }
  DatePickerDialog.OnDateSetListener myDateSetListener = new DatePickerDialog.OnDateSetListener() {
      @Override
      public void onDateSet(DatePicker datePicker, int i, int j, int k) {
          year = i;
          month = j;
          day = k;
          updateDisplay();
          editTextDate.setText(currentDate);
      }
  };`
  </code></pre>