Reputation: 1753
Is there possibility to set a custom date in DatePicker? I want to set a date in DatePicker, and then allow user to edit it. Thanks!
Upvotes: 0
Views: 3825
Reputation: 199
final Calendar c = Calendar.getInstance(Locale.ENGLISH);
mYear = c.get(Calendar.YEAR);
mMonth = c.get(Calendar.MONTH);
mDay = c.get(Calendar.DAY_OF_MONTH);
showDialog(DATE_DIALOG_ID);
Upvotes: 0
Reputation: 9252
Have you seen this tutorial? It says to set the DatePicker initially, use DatePicker.init:
Calendar cal=Calendar.getInstance(Locale.ENGLISH);
dp.init(cal.getTime().getYear()+1900, cal.getTime().getMonth(), cal.getTime().getDay(), this);
Upvotes: 1
Reputation: 21098
There's the DatePicker.init where you can set it...
Or to set the date you can use the calendar control as shown in the android developer sample. See Steps 4-6.
Here's another sample blog post on this.
Upvotes: 2