怎么用 android实现间隔10s获取一次当前时间
1个回答
展开全部
根据TimerDialogPicker选择时间:
final Calendar calendar = Calendar.getInstance();
TimePickerDialog a = new TimePickerDialog(
this,new OnTimeSetListener(){
@Override
public void onTimeSet(TimePicker view, int hourOfDay,
int minute) {
Settings.System.putInt(getContentResolver(), "start_time", hourOfDay*60+minute);
}},
calendar.get(Calendar.HOUR_OF_DAY),
calendar.get(Calendar.MINUTE),
DateFormat.is24HourFormat(this.getBaseContext()));
a.show();
TimePickerDialog b = new TimePickerDialog(
this,new OnTimeSetListener(){
@Override
public void onTimeSet(TimePicker view, int hourOfDay,
int minute) {
Settings.System.putInt(getContentResolver(), "end_time", hourOfDay*60+minute);
}},
calendar.get(Calendar.HOUR_OF_DAY),
calendar.get(Calendar.MINUTE),
DateFormat.is24HourFormat(this.getBaseContext()));
b.show();
final Calendar calendar = Calendar.getInstance();
TimePickerDialog a = new TimePickerDialog(
this,new OnTimeSetListener(){
@Override
public void onTimeSet(TimePicker view, int hourOfDay,
int minute) {
Settings.System.putInt(getContentResolver(), "start_time", hourOfDay*60+minute);
}},
calendar.get(Calendar.HOUR_OF_DAY),
calendar.get(Calendar.MINUTE),
DateFormat.is24HourFormat(this.getBaseContext()));
a.show();
TimePickerDialog b = new TimePickerDialog(
this,new OnTimeSetListener(){
@Override
public void onTimeSet(TimePicker view, int hourOfDay,
int minute) {
Settings.System.putInt(getContentResolver(), "end_time", hourOfDay*60+minute);
}},
calendar.get(Calendar.HOUR_OF_DAY),
calendar.get(Calendar.MINUTE),
DateFormat.is24HourFormat(this.getBaseContext()));
b.show();
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询