title: How to display from current month and year in date picker to restrict showing previous year and month android?
body: <p>I am using custom date picker where i am using like this.</p>
  
  <pre><code>public class DatePickersDialog extends DatePickerDialog implements OnDateChangedListener {
  
      private DatePickerDialog mDatePicker;
  
       public DatePickersDialog(Context context, OnDateSetListener callBack,
              int year, int monthOfYear, int dayOfMonth) {
          super(context,callBack, year, monthOfYear, dayOfMonth);
         mDatePicker = new DatePickerDialog(context,callBack, year, monthOfYear, dayOfMonth);
         mDatePicker.getDatePicker().init(year, monthOfYear, dayOfMonth, this);
          updateTitle(year, monthOfYear);
  
      }
      public void onDateChanged(DatePicker view, int year,
          int month, int day) {
      updateTitle(year, month);
      }
      private void updateTitle(int year, int month) {
          Calendar mCalendar = Calendar.getInstance();
          mCalendar.set(Calendar.YEAR, year);
          mCalendar.set(Calendar.MONTH, month);
          mDatePicker.setTitle(getFormat().format(mCalendar.getTime()));
  
      }  
      public DatePickerDialog getPicker(){
          return this.mDatePicker;
      }
  
      public SimpleDateFormat getFormat(){
      return new SimpleDateFormat("MMM, yyyy");
      };   
  
     }
  Utils.class 
  
  
  public static DatePickerDialog customDatePickers(Activity activity, DatePickerDialog.OnDateSetListener datePickerListener) {
  
      Calendar c = Calendar.getInstance();
      int cardYear = c.get(Calendar.YEAR);
      int cardMonth = c.get(Calendar.MONTH);
      int cardDay = c.get(Calendar.DAY_OF_MONTH);
      DatePickersDialog datePickersDialog = new DatePickersDialog(activity,datePickerListener,cardYear,cardMonth,cardDay);
      Date minDate = new Date();
      c.set(cardYear, cardMonth, cardDay - 1, 0, 0);
      minDate.setTime(c.getTimeInMillis());
      DatePickerDialog datePickerDialog = datePickersDialog.getPicker();
  
      try {
          Field[] datePickerDialogFields = datePickerDialog.getClass().getDeclaredFields();
          for (Field datePickerDialogField : datePickerDialogFields) {
              if (datePickerDialogField.getName().equals("mDatePicker")) {
                  datePickerDialogField.setAccessible(true);
                  DatePicker datePicker = (DatePicker) datePickerDialogField.get(datePickerDialog);
                  Field datePickerFields[] = datePickerDialogField.getType()
                          .getDeclaredFields();
                  for (Field datePickerField : datePickerFields) {
                      if ("mDayPicker".equals(datePickerField.getName()) || "mDaySpinner".equals(datePickerField.getName())) {
                          datePickerField.setAccessible(true);
                          Object dayPicker = new Object();
                          dayPicker = datePickerField.get(datePicker);
                          ((View) dayPicker).setVisibility(View.GONE);
                      }
                  }
              }
          }
          datePickerDialog.show();
      } catch (Exception ex) {
      }
      return datePickerDialog;
  }
  
   scanExpireDate = (CheckoutEditText) findViewById(R.id.scan_expire_date);
  scanExpireDate.setTextView();
  
  
  
  public void onDatePickerClick(View view){
              Utils.customDatePicker(this, datePickerListener);
      }
  </code></pre>
  
  <p>But it displays like this below pic. showing previous year and month. How to restrict that?
  <img src="https://i.stack.imgur.com/Kr789.png" alt="enter image description here"></p>
  
  <p>How to solove this?</p>
  
  <p>Thanks in advance</p>