TimePicker getCurrentHour - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for TimePicker getCurrentHour method.

This code example shows how to use the following methods:clearFocus, getCurrentHour, getCurrentMinute
			this.setButton(DialogInterface.BUTTON_POSITIVE, getContext().getText(android.R.string.ok), new DialogInterface.OnClickListener()
			{ 
				@Override 
				public void onClick(DialogInterface dialog, int which)
				{ 
					picker.clearFocus(); // focus must be cleared so the value change listener is called
					callback.onTimeSet(picker, picker.getCurrentHour(), picker.getCurrentMinute());
				} 
			}); 
		} 
		catch(Exception e)
		{ 
			// reflection probably failed 
		} 
	} 
} 
7
CodeRank
This code example shows how to use the following methods:getCurrentHour, getCurrentMinute, setCurrentHour, setCurrentMinute
    @Override 
    public void onDateChanged(DatePicker view, int year,
            int month, int day) {
        // Signal a time change so the max/min checks can be applied. 
        if (mTimePicker != null) {
            onTimeChanged(mTimePicker, mTimePicker.getCurrentHour(),
                    mTimePicker.getCurrentMinute());
        } 
    } 
 
    @Override 
    public void onTimeChanged(TimePicker view, int hourOfDay, int minute) {
        Time time = new Time();
        time.set(0, mTimePicker.getCurrentMinute(),
                mTimePicker.getCurrentHour(), mDatePicker.getDayOfMonth(),
                mDatePicker.getMonth(), mDatePicker.getYear());
 
        if (time.toMillis(true) < mMinTimeMillis) {
            time.set(mMinTimeMillis);
        } else if (time.toMillis(true) > mMaxTimeMillis) {

7
CodeRank
This code example shows how to use the following methods:getCurrentHour, getCurrentMinute, setCurrentHour, setCurrentMinute
This code example shows how to use the following methods:getCurrentHour, getCurrentMinute
 
        mCheckIsEndTime.setChecked(mKind == mPrefs.getCountDownTarget());
    } 
 
    public void onClickOk(View v) {
        int hour = mTimePicker.getCurrentHour();
        int min = mTimePicker.getCurrentMinute();
 
        mPrefs.setBellTime(mKind, hour * 3600 + min * 60);
        if (mCheckIsEndTime.isChecked()) {
            mPrefs.setCountDownTarget(mKind);
        } 
        finish();
    } 
 
    public void onClickCancel(View v) {
        finish();
    } 
} 
6
CodeRank
This code example shows how to use the following methods:clearFocus, getCurrentHour, getCurrentMinute
 
	@Override 
	protected void onDialogClosed(boolean positiveResult) {
		super.onDialogClosed(positiveResult);
		 
		mTimePicker.clearFocus();
		if(positiveResult) {
			handleTimeChange(mTimePicker.getCurrentHour(), 
							 mTimePicker.getCurrentMinute());
		} 
	} 
	 
	@Override 
	protected View onCreateDialogView() {
		 
		mTimePicker = new TimePicker(getContext());
		mTimePicker.setIs24HourView(false);
		mTimePicker.setCurrentHour(mTime.getHour());
		mTimePicker.setCurrentMinute(mTime.getMinute());
		mTimePicker.clearFocus();
7
CodeRank
This code example shows how to use the following methods:clearFocus, getCurrentHour, getCurrentMinute, setCurrentHour, setCurrentMinute
 
 
	public void onClick(View v) {
		// TODO Auto-generated method stub 
		dateP.clearFocus();
		timeP.clearFocus();
		if (!b_useTime)
		{ 
			timeP.setCurrentHour(23);
			timeP.setCurrentMinute(59);
		} 
		 
		Calendar datetime = Calendar.getInstance();
		datetime.set(dateP.getYear(), dateP.getMonth(), dateP.getDayOfMonth(), timeP.getCurrentHour(), timeP.getCurrentMinute(), 0);
		 
		DBAdapter dbA = new DBAdapter(this);
		dbA.open();
		if (_id < 0)
			dbA.addTask(subject, type.getSelectedItemPosition(), title.getText().toString(), desc.getText().toString(), datetime.getTimeInMillis(), b_useTime);
		else 
6
CodeRank
This code example shows how to use the following methods:getCurrentHour, getCurrentMinute
    } 
 
    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(); 
        } 
        super.onStop(); 
    } 
 
    @Override 
7
CodeRank
This code example shows how to use the following methods:clearFocus, getCurrentHour, getCurrentMinute
 
		@Override 
		public void onClick(DialogInterface dialog, int which) { 
			switch (which) { 
			case DialogInterface.BUTTON_POSITIVE: 
				timePicker.clearFocus(); 
				result = timePicker.getCurrentHour() + "-" 
						+ timePicker.getCurrentMinute(); 
				persistString(result); 
				callChangeListener(result); 
				dialog.dismiss(); 
				break; 
			case DialogInterface.BUTTON_NEGATIVE: 
				dialog.dismiss(); 
				break; 
			} 
 
		} 
	}; 
 
7
CodeRank
This code example shows how to use the following methods:getCurrentHour, getCurrentMinute
		super.onSetInitialValue(restore, defaultValue);
	} 
 
	@Override 
	public void onTimeChanged(TimePicker view, int hourOfDay, int minute) {
		String timeString = view.getCurrentHour() + ":"
				+ view.getCurrentMinute();
		if (shouldPersist()) 
			persistString(timeString);
		callChangeListener(timeString);
	} 
 
} 
6
CodeRank
This code example shows how to use the following methods:clearFocus, getCurrentHour, getCurrentMinute

Related TimePicker getCurrentHour Questions & Answers:

getCurrentHour Method Overview
See Code Examples for other Android TimePicker Methods: