Use of Android datepicker and timepicker controls
Public class timerpickeractivity extends activity {private datepicker; private timepicker; Private Static calendar = calendar. getinstance (); @ override protected void oncreate (bundle savedinstancestate) {super. oncreate (savedinstancestate); setcontentview (R. layout. timepicker); timepicker = (timepicker) findviewbyid (R. id. timepicker1); datepicker = (datepicker) findviewbyid (R. id. d Atepicker1); timepicker. setontimechangedlistener (New timepicker. ontimechangedlistener () {@ overridepublic void ontimechanged (timepicker view, int hourofday, int minute) {// todo auto-generated method stubstringbuffer buffer = new stringbuffer (); buffer. append (hourofday <10? "0" + hourofday: hourofday); buffer. append (":"). append (minute); toast. maketext (timerpickeractivity. this, buffer. tostring (), toast. length_short ). show () ;}}); datepicker = (datepicker) findviewbyid (R. id. datepicker1); int year = calendar. get (calendar. year); int month = calendar. get (calendar. month); int day = calendar. get (calendar. day_of_month); datepicker. init (year, month, day, new datepicker. ondatechangedlistener () {@ overridepublic void ondatechanged (datepicker view, int year, int monthofyear, int dayofmonth) {// todo auto-generated method stub }});}}