Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Check out this</p> <pre><code>class MyDataPicker extends DatePickerDialog{ int year, monthOfYear, dayOfMonth; final Calendar c; Date d1; public MyDataPicker(Context context, DatePickerDialog.OnDateSetListener callBack, int year, int monthOfYear, int dayOfMonth){ super(context, callBack, year, monthOfYear, dayOfMonth); this.year=year; this.monthOfYear=monthOfYear; this.dayOfMonth=dayOfMonth; d1= new Date(year, monthOfYear, dayOfMonth); c = Calendar.getInstance(); // TODO Auto-generated constructor stub } public void onDateChanged(DatePicker datepicker, int year, int month, int day){ long timeinmilies = d1.getTime(); Date d = new Date(year, month,day); long millis = d.getTime(); if(millis&lt;=timeinmilies){ this.year = year; this.monthOfYear = month; this.dayOfMonth = day; } datepicker.updateDate(this.year, monthOfYear, dayOfMonth); super.onDateChanged(datepicker,this.year, monthOfYear, dayOfMonth); } } private DatePickerDialog.OnDateSetListener myDateSetListener = new DatePickerDialog.OnDateSetListener(){ @Override public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) { // TODO Auto-generated method stub // set Date in EditText or textView Here DOB.setText((monthOfYear+1)+"-"+dayOfMonth+"-"+year); } }; // button click to open datepicker public void onClickPickDate(View view){ final Calendar c = Calendar.getInstance(); int myYear = c.get(Calendar.YEAR); int myMonth = (c.get(Calendar.MONTH)); int myDay = c.get(Calendar.DAY_OF_MONTH); MyDataPicker datePickerDialog = new MyDataPicker(this,myDateSetListener,myYear, myMonth, myDay); datePickerDialog.show(); } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload