title: Incrementing the date taken from a date time picker dialog by 39 weeks
body: <p>Hey guys i am working on an application that can be used to predict the due date of a babies birth but i have failed to figure out how to increment the date from the date time picker dialog below is my code </p>
  
  <pre><code>public class Dday extends Activity implements OnClickListener{
  
  private EditText fromDateEtxt;
  
  private DatePickerDialog fromDatePickerDialog;
  
  private SimpleDateFormat dateFormatter;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_dday);
  
      dateFormatter = new SimpleDateFormat("dd-MM-yyyy", Locale.US);
  
      findViewsById();
  
      setDateTimeField();
  }
  
  private void findViewsById() {
      fromDateEtxt = (EditText) findViewById(R.id.etxt_fromdate);    
      fromDateEtxt.setInputType(InputType.TYPE_NULL);
      fromDateEtxt.requestFocus();
  }
  
  private void setDateTimeField() {
      fromDateEtxt.setOnClickListener(this);
  
      Calendar newCalendar = Calendar.getInstance();
      fromDatePickerDialog = new DatePickerDialog(this, new OnDateSetListener() {
  
          public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
              Calendar newDate = Calendar.getInstance();
              newDate.set(year, monthOfYear, dayOfMonth);
              fromDateEtxt.setText(dateFormatter.format(newDate.getTime()));
          }
  
      },newCalendar.get(Calendar.YEAR), newCalendar.get(Calendar.MONTH), newCalendar.get(Calendar.DAY_OF_MONTH));
  }
  
  
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
      // Inflate the menu; this adds items to the action bar if it is present.
      getMenuInflater().inflate(R.menu.dday, menu);
      return true;
  }
  
  public void showDate (View view)
  {
      // Adding the days to the date 
  
      // Button action
  
      Intent dts = new Intent(this,Details.class);
  
      startActivity(dts);
  }
  
  @Override
  public void onClick(View view) {
      // TODO Auto-generated method stub
  
      if(view == fromDateEtxt) {
          fromDatePickerDialog.show();
      }
  }
  </code></pre>