Here you can find the source of updateDate(DatePicker picker, Date date)
Parameter | Description |
---|---|
picker | the date picker |
date | the date value |
public static void updateDate(DatePicker picker, Date date)
//package com.java2s; import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; import android.widget.DatePicker; public class Main { /**/*from w w w.j a v a2 s.co m*/ * Convinient method to update a date in a {@link DatePicker}. * @param picker the date picker * @param date the date value */ public static void updateDate(DatePicker picker, Date date) { if (picker != null && date != null) { Calendar c = GregorianCalendar.getInstance(); c.setTime(date); int y = c.get(Calendar.YEAR); int m = c.get(Calendar.MONTH); int d = c.get(Calendar.DAY_OF_MONTH); picker.updateDate(y, m, d); } } }