3

I can't figure out this stupid little bug. Whenever I initiate the DatePickerDialog, the default set date date is Jan/01/1900.

It's weird though because on the tablet there's a calendar view next to the slider which you can pick from as well and THATS set on the current date, but the slider isn't.

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);
    }
}
4

1 回答 1

6

我是个白痴。构造函数中的参数顺序是年、月、日。

于 2013-10-04T15:36:37.380 回答