开发者

set DatePickerDialog one day before

hi I have a datepickerdialog but i´d like to change always one day before

DatePickerDialog.OnDateSetListener dini=new DatePickerDialog.OnDateSe开发者_开发百科tListener() {
    public void onDateSet(DatePicker view, int year, int monthOfYear,
            int dayOfMonth) {
        myInitialDate.set(Calendar.YEAR, year);
        myInitialDate.set(Calendar.MONTH, monthOfYear);
        myInitialDate.set(Calendar.DAY_OF_MONTH, dayOfMonth);
        monthOfYear +=1; //fix month            
    }
};


Build a Calendar object, do the date arithmetic there and extract the new year/moy/dom using its getters.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜