在blackberry中启动时间选择器时,时间选择器为常量
在这里,我使用黑莓8520显示计时器。我想将时间设置为10:00:00,直到时间选择器开始更改simuator中的时间在blackberry中启动时间选择器时,时间选择器为常量,blackberry,Blackberry,在这里,我使用黑莓8520显示计时器。我想将时间设置为10:00:00,直到时间选择器开始更改simuator中的时间 public void run() { //create timepicker by using this method //by using this simpledateformat we set time format SimpleDateFormat tim
public void run()
{
//create timepicker by using this method
//by using this simpledateformat we set time format
SimpleDateFormat timeFormat = new SimpleDateFormat("hh:mm:ss aa");
DateTimePicker datepicker = DateTimePicker.createInstance(Calendar.getInstance(),null,"hh:mm:ss aa");
datepicker.doModal();
StringBuffer datestrTime=new StringBuffer();
//by using this method we get date from system date&time
Calendar cal = datepicker.getDateTime();
timeFormat.format(cal,datestrTime, null);
// we are taking the current time from the system and displaying in the label field
time_picker.setText(datestrTime.toString());
}
使用以下代码:
Calendar cal = Calendar.getInstance();
cal.set(Calendar.HOUR,10);
cal.set(Calendar.MINUTE,00);
cal.set(Calendar.SECOND,00);
datepicker.setDateTime(cal);
datepicker.doModal();
使用以下代码:
Calendar cal = Calendar.getInstance();
cal.set(Calendar.HOUR,10);
cal.set(Calendar.MINUTE,00);
cal.set(Calendar.SECOND,00);
datepicker.setDateTime(cal);
datepicker.doModal();