1 回答

TA貢獻1803條經驗 獲得超6個贊
如果我錯了,請原諒我。我不熟悉那些觀點。但是,我認為你應該使用:
TimePickerDialog tpd = new TimePickerDialog(this, null,
now.get(Calendar.HOUR_OF_DAY), now.get(Calendar.MINUTE), false);
和
DatePickerDialog dpd = new DatePickerDialog (this, null, now.get(Calendar.YEAR),
now.get(Calendar.MONTH), now.get(Calendar.DAY_OF_MONTH);
如果這有幫助,請告訴我。否則,我會刪除我的答案
編輯
我猜你是從某個庫(擴展了 a )復制了代碼DialogFragment。這就是為什么你有一些沖突。
為了使您的代碼使用這些的默認實現工作Dialog,您可以使用:
public void setTime(View v) {
if (mCurrentReminderUri == null) {
Toast.makeText(this, "click again on the reminder list to set time alarm", Toast.LENGTH_LONG).show();
return;
}
Calendar now = Calendar.getInstance();
TimePickerDialog tpd = new TimePickerDialog(this, null,
now.get(Calendar.HOUR_OF_DAY), now.get(Calendar.MINUTE), false);
tpd.show();
}
// On clicking Date picker
public void setDate(View v) {
if (mCurrentReminderUri == null) {
Toast.makeText(this, "click again on the reminder list to set date alarm", Toast.LENGTH_LONG).show();
return;
}
Calendar now = Calendar.getInstance();
DatePickerDialog dpd = new DatePickerDialog (this, null, now.get(Calendar.YEAR),
now.get(Calendar.MONTH), now.get(Calendar.DAY_OF_MONTH));
dpd.show();
}
添加回答
舉報