Registering Ontouch events with EditText
Etsscxnssbdate.setontouchlistener (Selectdatetouchlistener);
//Select a Date PrivateOntouchlistener Selectdatetouchlistener =NewOntouchlistener () {@Override Public BooleanOnTouch (View V, motionevent event) {if(event.getaction () = =motionevent.action_up) { FinalCalendar cd=calendar.getinstance (); Date Date=NewDate (); Cd.settime (date); Datepickerdialog DP=NewDatepickerdialog (Getactivity (),NewOndatesetlistener () { Public voidOndateset (DatePicker view,intYearintMonthofyear,intdayofmonth) {String Datestr= year+ "-" +strutil.adjustmonthday (monthofyear+1); //when the user selects the end of the month, the query operation if(Phoneinfo.isconnectinternet (Getactivity ())) {Etsscxnssbdate.settext (DATESTR); Donssbqkselect (); }Else{Uiutil.radialog (getactivity (), wr.net_not_conn); }}}, Cd.get (calendar.year), Cd.get (Calendar.month), Cd.get (Calendar.day_of_month)); Dp.show (); //Hidden Days if(DP! =NULL) { intSdkversion =Phoneinfo.getsdkversionnumber (); if(Sdkversion < 11{(ViewGroup) Dp.getdatepicker (). Getchildat (0). Getchildat (2). setvisibility (View.gone); } Else if(Sdkversion > 14{(ViewGroup) ((ViewGroup) Dp.getdatepicker (). Getchildat (0). Getchildat (0)). Getchildat (2). setvisibility (View.gone); }} etsscxnssbdate.setinputtype (Inputtype.type_null); } return false; } };
/*** Get the System SDK version *@return */ Public Static intGetsdkversionnumber () {intsdkversion; Try{sdkversion=integer.valueof (Android.os.Build.VERSION.SDK_INT); } Catch(NumberFormatException e) {sdkversion= 0; } returnsdkversion; }