How do I set the current date in a DatePicker?

后端 未结 6 2242
夕颜
夕颜 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:10

    You can query the current date through the Calendar class.

    Calendar now = Calendar.getInstance();
    now.get(Calendar.WHATDOYOUNEED);
    

    Feed it's get() method with different parameters to customize your query.

提交回复
热议问题