title: Android - Update minDate and maxDate of a DatePicker many times
body: <p>I've 2 DatePicker, the first is the start date and the second is the end date. I'want that both have maxDate the current date (and this works with my code) and i want that when i change start date the minDate of second DatePicker will update to this date (and vice versa). With this listner i handle the action but second DatePicker doesn't refresh its minDate on layout.</p>
  
  <pre><code>private DatePicker.OnDateChangedListener startDataListener = new DatePicker.OnDateChangedListener() {
  
      public void onDateChanged(DatePicker view, int year, int monthOfYear,
              int dayOfMonth) { 
          Calendar c = Calendar.getInstance();
          c.set(year, monthOfYear, dayOfMonth);
          endDate.setMinDate(c.getTimeInMillis());
      }
  };
  
  private DatePicker.OnDateChangedListener endDateListener = new DatePicker.OnDateChangedListener() {
  
      public void onDateChanged(DatePicker view, int year, int monthOfYear,
              int dayOfMonth) {
  
          Calendar c = Calendar.getInstance();
          c.set(year, monthOfYear, dayOfMonth);
          startDate.setMaxDate(c.getTimeInMillis());
      }
  };
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      startDate= (DatePicker)findViewById(***);
      endDate= (DatePicker)findViewById(***);
  
      startDate.setMaxDate(Calendar.getInstance().getTimeInMillis());
      startDate.init(year, month, day, startDateListener);
  
      endDate.setMinDate(c.getTimeInMillis()-1000);
      endDate.setMaxDate(c.getTimeInMillis());
      endDate.init(year, month, day, endDateListener);
  }
  </code></pre>