I am wanting to create a gestation period calculator for my app. I want to grab the date that the user had picked in the date time picker and advance that date by 9 months and 10 days and print it out in a textView. I am able to get the date from the date picker and print the date into the textView but what I need to do now is to advance the date by the 9 months and 10 days. Any ideas? and here is my current code for getting the date from the date picker and printing it to a text view.
public class GestationPeriod extends Activity {
DatePicker date;
TextView gestationperiodView;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.gestationperiod);
setupVariables();
}
public void calculate(View v){
int gestationPeriodMonth = 9;
int gestationPeriodDay = 10;
int year = date.getYear();
int month = date.getMonth();
int day = date.getDayOfMonth();
gestationperiodView.setText("" + day + " / " + month + " / " + year);
}
private void setupVariables(){
date = (DatePicker) findViewById(R.id.datePicker1);
gestationperiodView = (TextView) findViewById(R.id.editText1);
}
Your help would be much appreciated.