Datepickerdiaolog
Android Datepickerdiaolog is a pop-up time management window,datepickerdiaolog description of the month-day time ; Unlike Timepickerdiaolog, Timepickerdiaolog describes the specific time of day, Timepickerdiaolog has two means, one is 12 hours, one is 24 hour system.
Let's take a look at a specific example:
//定义全局变量 private Calendar mCalendar; private Button mButtonDatePickerDialog;
//Define a method for displaying Datepickerdiaolog Private void Showdatepickerdialog() {//Get the Calendar objectMcalendar = Calendar.getinstance ();//Create an Datepickerdialog objectDatepickerdialog Datedialog =NewDatepickerdialog (dialogactivity. This,NewDatepickerdialog.ondatesetlistener () {@Override Public void Ondateset(DatePicker DatePicker,intIintI1,intI2) {Mcalendar.set (i, I1, i2); SimpleDateFormat format =NewSimpleDateFormat ("yyyy year mm DD Day"); Toast.maketext (Getapplicationcontext (),""+ Format.format (Mcalendar.gettime ()), Toast.length_short). Show (); }}, Mcalendar.get (Calendar.year), Mcalendar.get (Calendar.month), Mcalendar.get (Calendar.day_of_month)); Datedialog.show (); }
Copyright NOTICE: This article for Bo Master original article, welcome reprint, Reprint please in the article conspicuous place to explain the article source and give the connection.
The use of Datepickerdiaolog in Android