Вы можете создать пользовательский TimePicker, который позволяет установить минимальное время, вы можете попробовать это решение
public class CustomTimePicker extends TimePickerDialog {
private int mMinHour = -1;
private int mMinMinute = -1;
private int mMaxHour = 100;
private int mMaxMinute = 100;
private int mCurrentHour;
private int mCurrentMinute;
public CustomTimePicker(Context context, OnTimeSetListener callBack, int hourOfDay,
int minute, boolean is24HourView) {
super(context, callBack, hourOfDay, minute, is24HourView);
mCurrentHour = hourOfDay;
mCurrentMinute = minute;
// Somehow the onTimeChangedListener is not set by TimePickerDialog
// in some Android Versions, so, Adding the listener using
// reflections
try {
Class<?> superclass = getClass().getSuperclass();
Field mTimePickerField = superclass.getDeclaredField("mTimePicker");
mTimePickerField.setAccessible(true);
TimePicker mTimePicker = (TimePicker) mTimePickerField.get(this);
mTimePicker.setOnTimeChangedListener(this);
} catch (NoSuchFieldException e) {
} catch (IllegalArgumentException e) {
} catch (IllegalAccessException e) {
}
}
public void setMin(int hour, int minute) {
mMinHour = hour;
mMinMinute = minute;
}
public void setMax(int hour, int minute) {
mMaxHour = hour;
mMaxMinute = minute;
}
@Override
public void onTimeChanged(TimePicker view, int hourOfDay, int minute) {
super.onTimeChanged(view, hourOfDay, minute);
boolean validTime;
if (((hourOfDay < mMinHour) || (hourOfDay == mMinHour && minute < mMinMinute))
|| ((hourOfDay > mMaxHour) || (hourOfDay == mMaxHour && minute > mMaxMinute))) {
validTime = false;
} else {
validTime = true;
}
if (validTime) {
mCurrentHour = hourOfDay;
mCurrentMinute = minute;
} else {
updateTime(mCurrentHour, mCurrentMinute);
}
}}
Теперь используйте CustomTimePicker как:
CustomTimePicker customTimePicker = new CustomTimePicker(AddExtraForecast.this, new TimePickerDialog.OnTimeSetListener() {
@Override
public void onTimeSet(TimePicker view, int hourOfDay, int minute)
{
int selected_hour = hourOfDay;
int selected_minutes = minute;
String min = "", hours = "";
if (selected_hour < 10)
hours = "0" + selected_hour;
else
hours = String.valueOf(selected_hour);
if (selected_minutes < 10)
min = "0" + selected_minutes;
else
min = String.valueOf(selected_minutes);
// Append in a StringBuilder
String aTime = new StringBuilder().append(hours).append(":")
.append(min).append(":").append("00").toString();
}, new Time(System.currentTimeMillis()).getHours(), new Time(System.currentTimeMillis()).getMinutes(), true);
customTimePicker.updateTime(// hours_in_integer, mins_in_integer));
customTimePicker.setMin(Integer.parseInt(// hours_in_integer, mins_in_integer));
customTimePicker.show();