public TimePickerDialog(
     Context context,
     int theme,
     OnTimeSetListener callBack,
     int hourOfDay,
     int minute,
     boolean is24HourView) {
   super(context, theme);
   mCallback = callBack;
   mInitialHourOfDay = hourOfDay;
   mInitialMinute = minute;
   mIs24HourView = is24HourView;
   setIcon(0);
   setTitle(R.string.time_picker_dialog_title);
   Context themeContext = getContext();
   setButton(DialogInterface.BUTTON_POSITIVE, themeContext.getText(R.string.date_time_set), this);
   setButton(
       DialogInterface.BUTTON_NEGATIVE,
       themeContext.getText(android.R.string.cancel),
       (OnClickListener) null);
   View view = LayoutInflater.inflate(themeContext, R.layout.time_picker_dialog);
   setView(view);
   mTimePicker = (TimePicker) view.findViewById(R.id.timePicker);
   mTimePicker.setIs24HourView(mIs24HourView);
   mTimePicker.setCurrentHour(mInitialHourOfDay);
   mTimePicker.setCurrentMinute(mInitialMinute);
   mTimePicker.setOnTimeChangedListener(this);
 }
 @Override
 public Bundle onSaveInstanceState() {
   Bundle state = super.onSaveInstanceState();
   state.putInt(TimePickerDialog.HOUR, mTimePicker.getCurrentHour());
   state.putInt(TimePickerDialog.MINUTE, mTimePicker.getCurrentMinute());
   state.putBoolean(TimePickerDialog.IS_24_HOUR, mTimePicker.is24HourView());
   return state;
 }
 @Override
 public void onClick(DialogInterface dialog, int which) {
   if (mCallback != null) {
     mTimePicker.clearFocus();
     mCallback.onTimeSet(
         mTimePicker, mTimePicker.getCurrentHour(), mTimePicker.getCurrentMinute());
   }
 }
 @Override
 public void onRestoreInstanceState(Bundle savedInstanceState) {
   super.onRestoreInstanceState(savedInstanceState);
   int hour = savedInstanceState.getInt(TimePickerDialog.HOUR);
   int minute = savedInstanceState.getInt(TimePickerDialog.MINUTE);
   mTimePicker.setIs24HourView(savedInstanceState.getBoolean(TimePickerDialog.IS_24_HOUR));
   mTimePicker.setCurrentHour(hour);
   mTimePicker.setCurrentMinute(minute);
 }
 public void updateTime(int hourOfDay, int minutOfHour) {
   mTimePicker.setCurrentHour(hourOfDay);
   mTimePicker.setCurrentMinute(minutOfHour);
 }