Code example for TimePicker

Methods: getCurrentHourgetCurrentMinute

0
        mTimePicker.setOnTimeChangedListener(this);
    } 
 
    @Override 
    public void onClick(DialogInterface dialog, int which) {
        tryNotifyDateTimeSet(); 
    } 
 
    private void tryNotifyDateTimeSet() { 
        if (mCallBack != null) {
            mDatePicker.clearFocus();
            mCallBack.onDateTimeSet(mDatePicker, mTimePicker, mDatePicker.getYear(),
                    mDatePicker.getMonth(), mDatePicker.getDayOfMonth(),
                    mTimePicker.getCurrentHour(), mTimePicker.getCurrentMinute());
        } 
    } 
 
    @Override 
    protected void onStop() { 
        if (Build.VERSION.SDK_INT >= 16) {
            tryNotifyDateTimeSet();