How to get date from date picker in android?

前端 未结 7 1574
眼角桃花
眼角桃花 2021-01-13 10:29

I am using the DatePicker for my application. I want to get the date that I have selected (on the DatePicker), but it\'s not returning the selected

7条回答
  •  伪装坚强ぢ
    2021-01-13 11:17

    I think this is what you need

    // the call back received when the user "sets" the date in the dialog
    private DatePickerDialog.OnDateSetListener mDateSetListener =
        new DatePickerDialog.OnDateSetListener() {
            public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
                mYear = year;
                mMonth = monthOfYear;
                mDay = dayOfMonth;
    
            }
    };
    

提交回复
热议问题