Code example for TimePicker

Methods: setCurrentHoursetCurrentMinutesetEnabled

0
		if (data != null) 
		{ 
			if (!data.isUndefined()) 
			{ 
				datepicker.init(data.getYear(), data.getMonth() - 1, data.getDayOfMonth(), null);
				timepicker.setCurrentHour(data.getHour());
				timepicker.setCurrentMinute(data.getMinute());
			} 
		} 
		isForeverCheckBox.setChecked(checked);
		if (isForeverCheckBox.isChecked())
		{ 
			setEnabledComponents(false); 
		} 
		 
	} 
	 
 
	public void onClick(View v)
	{ 
		// TODO Auto-generated method stub 
		if (v.equals(okButton))
		{ 
			Time t = null; 
			if (isForeverCheckBox.isChecked())
			{ 
				t = new Time(); 
			} 
			else 
			{ 
				t = new Time(datepicker.getYear(), datepicker.getMonth(), datepicker.getDayOfMonth(), timepicker.getCurrentHour(), timepicker.getCurrentMinute());
				 
			} 
			 
			listener.pickTimerDateSet(t);
			dismiss();
			try 
			{ 
				finalize(); 
			} 
			catch (Throwable e)
			{ 
				// TODO Auto-generated catch block 
				e.printStackTrace();
			} 
		} 
		else if (v.equals(isForeverCheckBox))
		{ 
			setEnabledComponents(!isForeverCheckBox.isChecked());
			checked = isForeverCheckBox.isChecked();
		} 
	} 
	 
 
	private void setEnabledComponents(boolean flag)
	{ 
		datepicker.setEnabled(flag);
		timepicker.setEnabled(flag);
	} 
	 
	public interface PickTimeDateSetListener 
	{ 
		public void pickTimerDateSet(Time time);