title: Restrict time picker for time Selection between two hours
body: <pre><code>fun openTimePicker(){
      mHour = c.get(Calendar.HOUR_OF_DAY)
      mMinute = c.get(Calendar.MINUTE)
      c.setTime(c.getTime());
      // Launch Time Picker Dialog
      val timePickerDialog = TimePickerDialog(this,
              TimePickerDialog.OnTimeSetListener {
                  view, hourOfDay, minute -&gt;
                  hour = hourOfDay
                  minutes = minute
                  var timeSet = ""
                  if (hour &gt; 12) {
                      hour -= 12
                      timeSet = "PM"
                  } else if (hour === 0) {
                      hour += 12
                      timeSet = "AM"
                  } else if (hour === 12) {
                      timeSet = "PM"
                  } else {
                      timeSet = "AM"
                  }
                  if (minutes &lt; 10)
                      min = "0$minutes"
                  else
                      min = minutes.toString()
                  val date = StringBuilder()
                  date.append(hour).append(':')
                          .append(min ).append(" ").append(timeSet).toString()
                  Toast.makeText(this,date,Toast.LENGTH_LONG).show()
                 // txtTime.setText(hourOfDay.toString() + ":" + minute)
              },
              mHour, mMinute, false)
  
      timePickerDialog.show()
  }
  </code></pre>
  
  <p>I want to select a time from 10 am to 2 pm only and then select 4 pm to 8 pm in the time picker dialog.
  I added code but how to set range in time selection
  where I put minimum range and maximum range in it</p>