2
我從哪裏可以設置從日期選取器和時間選擇在一次時間和日期驗證碼:如何爲選定的日期和時間設置鬧鐘?
private void dialoguetime() {
final Dialog dialog = new Dialog(this);
dialog.setContentView(R.layout.custom_dialogue);
dialog.setCancelable(true);
dialog.setTitle("This is Dialog 1");
dialog.show();
TimePicker time_picker = (TimePicker) dialog
.findViewById(R.id.timePicker1);
hours = time_picker.getCurrentHour();
minute = time_picker.getCurrentMinute();
time_picker.setOnTimeChangedListener(new OnTimeChangedListener() {
public void onTimeChanged(TimePicker view, int hourOfDay,
int minutes) {
// TODO Auto-generated method stub
// Toast.makeText(CustomDialog.this,
// "hourOfDay = "+hourOfDay+"minute = "+minute , 1000).show();
hours = hourOfDay;
minute = minutes;
}
});
final DatePicker date_picker = (DatePicker) dialog
.findViewById(R.id.datePicker1);
Button btn = (Button) dialog.findViewById(R.id.button2);
btn.setOnClickListener(new OnClickListener() {
public void onClick(View arg0) {
// TODO Auto-generated method stub
xDate = date_picker.getYear() + "-"+ (date_picker.getMonth() + 1) + "-"+ date_picker.getDayOfMonth() + " " + hours+ ":" + minute + ":00";
Toast.makeText(
getApplicationContext(),
xDate, Toast.LENGTH_LONG)
.show();
dialog.cancel();
}
}
);
}
由此我可以得到一個字符串作爲這樣yyyy-mm-dd hh:mm:ss
日期格式,現在我想向該選定時間的用戶發出警報(作爲警報)。我爲此使用了鬧鈴管理器,但它不允許我選擇該日期?
我該怎麼做?
請發佈您的報警管理器代碼。 – Tushar 2012-07-26 21:26:59
我是alerm經理的開工人員,我使用的報警管理器在另一個項目中,每隔15分鐘發送一次短信,但我知道不會在這裏工作 – Reyjohn 2012-07-26 21:31:27