title: Validation on timepicker according to date selection
body: <p>I am creating an app in which i am showing Date Picker and Time Picker with validation.I validated the Time Picker as i compare current time to selected time and set message "Select Correct time",it's working correctly when select current date but when i select another date it also show "Select Correct Time".I want to make it in this way that when i select another date i should permit me to select any time .I know i have to set it according to date selection but i don't know how to set this.?</p>
  
  <pre><code>    Calender c = Calendar.getInstance();
      year = c.get(Calendar.YEAR);
      month = c.get(Calendar.MONTH);
      day = c.get(Calendar.DAY_OF_MONTH);
      hourofday = c.get(Calendar.HOUR_OF_DAY);
      minuteofday = c.get(Calendar.MINUTE);
      totalCurrenttime = hourofday + minuteofday;
  
  
  
  private void showDateDailog() {
  
      final DatePickerDialog datePickerDialog = new DatePickerDialog(mContext, new DatePickerDialog.OnDateSetListener() {
  
          @Override
          public void onDateSet(DatePicker datePicker, int selectedYear, int selectedMonth, int selectedDate) {
  
              year = selectedYear;
              month = selectedMonth;
              day = selectedDate;
  
  
                  ((TextView) findViewById(R.id.textViewTORStartDate)).setText(new StringBuilder().append(day).append("/")
                          .append(month + 1).append("/").append(year))
          }
      }, year, month, day);
      datePickerDialog.getDatePicker().setMinDate(System.currentTimeMillis());
      datePickerDialog.show();
  }
  
  private void showTimeDailog() {
      TimePickerDialog timePickerDialog = new TimePickerDialog(mContext, new TimePickerDialog.OnTimeSetListener() {
          @Override
          public void onTimeSet(TimePicker view, int selectedHour, int selectedMinute) {
  
              hour = selectedHour;
              minute = selectedMinute;
              int selectedTime = hour + minute;
  
                  if (validTime(totalCurrenttime, selectedTime)) {
                      ((TextView) findViewById(R.id.textViewTORStartTime)).setText(selectedHour + ":" + selectedMinute);
                  } else {
                      Toast.makeText(getApplicationContext(), R.string.txt_select_correct_time, Toast.LENGTH_SHORT).show();
                      ((TextView) findViewById(R.id.textViewTORStartTime)).setText(R.string.txt_Start_Time);
                  }                   
          }
      }, hour, minute, timeview);
      timePickerDialog.show();
  }
  
  
  public boolean validTime(long current, long selected) {
  
      boolean isValid = false;
      if (selected &gt; current) {
          isValid = true;
      }
      return isValid;
  }
  </code></pre>