Question

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);
    }
}
Was it helpful?

Solution

I'm an idiot. Order of parameters in constructor is year, month then date.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top