I have a problem setting a date() at the datepicker item at my activity ,I use the bellow code and the date does not apply at DatePicker, what is wrong ?
Date date = myapp.getAdate();// the date instance
Calendar cal = Calendar.getInstance();
cal.setTime(date);
DatePicker picker=(DatePicker)findViewById(R.id.datePicker1);
int year=cal.get(Calendar.YEAR);
int day=cal.get(Calendar.DAY_OF_MONTH);
int mnth=cal.get(Calendar.MONTH)-1;
picker.init( year, mnth,day,null);
[EDIT] I noticed that the problem is the date that I set -> cal.setTime(date);
How I have to set the date, it has the format dd/MM/yyyy
[EDIT No 2] I solve this problem ,it works ok for now.Thank you!
Date date = myapp.getAdate();// the date instance
Calendar cal = Calendar.getInstance();
cal.setTime(date);
DatePicker picker=(DatePicker)findViewById(R.id.datePicker1);
int year=cal.get(Calendar.YEAR);
int day=cal.get(Calendar.DAY_OF_MONTH);
int mnth=cal.get(Calendar.MONTH)-1;
picker.init( year, mnth,day,null);
[EDIT] I noticed that the problem is the date that I set -> cal.setTime(date);
How I have to set the date, it has the format dd/MM/yyyy
[EDIT No 2] I solve this problem ,it works ok for now.Thank you!
Last edited: