java - Datepicker when show, select date first -


i have edittext, , when click on this, show adatepicker . wish when click on edittext , date appears in first choice , , after selection of month , day.

this code, listener

    date.setonfocuschangelistener(new view.onfocuschangelistener() {         @override         public void onfocuschange(view v, boolean hasfocus) {             if (hasfocus) {                  myear = mycalendar.get(calendar.year);                 //add+1 month, mycalendar start @ month 0                 mmmonth = mycalendar.get(calendar.month);                 mmonth = mmmonth + 1;                 mdayofmonth = mycalendar.get(calendar.day_of_month);                   final datepickerdialog mdatepicker = new datepickerdialog(register.this, new datepickerdialog.ondatesetlistener() {                     @override                     //method setdate edit text                     public void ondateset(datepicker view, int year, int monthofyear, int dayofmonth) {                          //set edittext selected date user                         if (year <= (myear - 18) && date.tostring().length() >= 5) {                             date.settext(dayofmonth + "/" + monthofyear + "/" + year);                             setannee(myear);                             setmois(mmonth);                             setjour(mdayofmonth);                             date.settextcolor(color.black);                         } else {                             date.settext("wrong");                             date.settextcolor(color.red);                             setannee(0);                             setmois(0);                             setjour(0);                         }                     }                  }, myear, mmonth, mdayofmonth);                 mdatepicker.settitle("select birthday date");                  mdatepicker.show();              } 

enter image description here

thank in advance!


Comments

Popular posts from this blog

Java 3D LWJGL collision -

spring - SubProtocolWebSocketHandler - No handlers -

methods - python can't use function in submodule -