[mono-android] Using DatePickerDialog
John Murray
john at murray.gb.com
Sun Mar 27 06:19:37 EDT 2011
Hello Liam
I'm only a rookie on this - an ancient trying to get back into something
modern but the sky-gods on here have helped a lot so I'm pleased to try and
help back - this is just a way of me qualifying I may not be right about all
of this but hope it helps :-)
FWIW this lot works 'out of the box' for me
You set up a dialog on, say, a button click
Thus
Bdeptime = FindViewById<Button>(Resource.Id.Bdeptime);
Bdeptime.Click += (o, e) => ShowDialog(TIME_DIALOG_ID);
Then write a dialog 'oncreate' override thus
protected override Dialog OnCreateDialog(int id)
{
switch (id)
{
case TIME_DIALOG_ID:
return new TimePickerDialog(this, TimePickerCallback,
hour, minute, false);
case DATE_DIALOG_ID:
// return new DatePickerDialog(this);
return new DatePickerDialog(this, DatePickerCallback,
2011, 1, 1);
you then probably need some callback to deal with consequential actions from
the dialog thus
private void TimePickerCallback(object sender,
TimePickerDialog.TimeSetEventArgs e)
{
hour = e.HourOfDay;
minute = e.Minute;
UpdateDisplay(); // do something with the chosen info
}
John Murray
-----Original Message-----
From: monodroid-bounces at lists.ximian.com
[mailto:monodroid-bounces at lists.ximian.com] On Behalf Of Liam
Sent: 27 March 2011 09:51
To: monodroid at lists.ximian.com
Subject: [mono-android] Using DatePickerDialog
Hi
Has anyone successfully implemented the DatePickerDialog? I see there
were a couple of emails about it in the mailing list a while ago.
The tutorial on the website is missing something when it comes to
implementing the create dialog method.
If anyone knows of some working code out there or could let me know what
the tutorial is missing that would be much appreciated.
Thanks
Liam
_______________________________________________
Monodroid mailing list
Monodroid at lists.ximian.com
UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid
More information about the Monodroid
mailing list