Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to show the Calender of only one year from current date in Android?
    primarykey
    data
    text
    <p>I want that the calender show user only one year date and rest will be disabled for the past it is working fine .But now i want to make so that the user can select only one year calender from current date.here is my code .Please suggest me the changes.</p> <pre><code>textView1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub showDialog(DATE_DIALOG_ID); } }); protected Dialog onCreateDialog(int id) { final Calendar now = Calendar.getInstance(); switch (id) { case DATE_DIALOG_ID: // set date picker as current date DatePickerDialog _date = new DatePickerDialog(this, date,myCalendar .get(Calendar.YEAR), myCalendar.get(Calendar.MONTH), myCalendar.get(Calendar.DAY_OF_MONTH)){ @Override public void onDateChanged(DatePicker view, int year, int monthOfYear, int dayOfMonth) { if (year &lt; now.get(Calendar.YEAR)) view.updateDate(myCalendar .get(Calendar.YEAR), myCalendar .get(Calendar.MONTH), myCalendar.get(Calendar.DAY_OF_MONTH)); if (monthOfYear &lt; now.get(Calendar.MONTH) &amp;&amp; year == now.get(Calendar.YEAR)) view.updateDate(myCalendar .get(Calendar.YEAR), myCalendar .get(Calendar.MONTH), myCalendar.get(Calendar.DAY_OF_MONTH)); if (dayOfMonth &lt; now.get(Calendar.DAY_OF_MONTH) &amp;&amp; year == now.get(Calendar.YEAR) &amp;&amp; monthOfYear == now.get(Calendar.MONTH)) view.updateDate(myCalendar .get(Calendar.YEAR), myCalendar .get(Calendar.MONTH), myCalendar.get(Calendar.DAY_OF_MONTH)); } }; return _date; } return null; } </code></pre>
    singulars
    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.
 

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