我无法弄清楚这个愚蠢的小虫子。每当我启动DatePickerDialog时,默认的设置日期日期是Jan / 01/1900。
这很奇怪,因为在平板电脑上有一个滑块旁边的日历视图,您可以从中选择并在当前日期设置THATS,但滑块不是。
public static class DatePickerFragment extends DialogFragment implements
DatePickerDialog.OnDateSetListener {
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
Log.d("month",Integer.toString(mMonth)); //Is returning current month, like it should
return new DatePickerDialog(getActivity(), this, mDay, mMonth, mYear); //all set to current date
}
public void onDateSet(DatePicker view, int year, int month, int day) {
dateDue.setText(month + 1 + "/" + day + "/" + year);
}
}
答案 0 :(得分:4)