How do I set the current date in a DatePicker?

后端 未结 6 2250
夕颜
夕颜 2020-12-09 09:23

I need to be able to choose date and time in my application It should either be done by using a dialog, or starting a new intent.

The way I have done it now, is that

6条回答
  •  天涯浪人
    2020-12-09 10:13

    If you are simply looking for the equivalent of setCurrentHour() and setCurrentMinute() on TimePicker, but on DatePicker - see updateDate (int year, int month, int dayOfMonth) on DatePicker.

    DatePicker mDatePicker = (DatePicker) findViewById(R.id.datePicker);
    mDatePicker.updateDate(1994, 6, 12);
    // Sets date displayed on DatePicker to 12th June 1994
    

提交回复
热议问题