请原谅,如果这是一个noob问题。我尝试了每一种可能性,从五个编辑文本中每天设置五个警报。但没有任何工作!我还有一个按钮(在此代码中未显示)更新这些编辑文本(因此也应该更新闹钟时间)。这里是我的代码:每天设置五个闹铃,并通过点击按钮进行更新
for (int i = 0; i < 5; i++) {
switch (i) {
case 0:
fajr.setText(result[i]);
tFajr = new GregorianCalendar();
tFajr.set(year, month, day,
Integer.parseInt(result[i].substring(0, 2)),
Integer.parseInt(result[i].substring(3, 5)));
break;
case 1:
zuhr.setText(result[i]);
tZuhr = new GregorianCalendar();
tZuhr.set(year, month, day,
Integer.parseInt(result[i].substring(0, 2)),
Integer.parseInt(result[i].substring(3, 5)));
break;
case 2:
asr.setText(result[i]);
tAsr = new GregorianCalendar();
tAsr.set(year, month, day,
Integer.parseInt(result[i].substring(0, 2)),
Integer.parseInt(result[i].substring(3, 5)));
break;
case 3:
maghrib.setText(result[i]);
tMaghrib = new GregorianCalendar();
tMaghrib.set(year, month, day,
Integer.parseInt(result[i].substring(0, 2)),
Integer.parseInt(result[i].substring(3, 5)));
break;
case 4:
isha.setText(result[i]);
tIsha = new GregorianCalendar();
tIsha.set(year, month, day,
Integer.parseInt(result[i].substring(0, 2)),
Integer.parseInt(result[i].substring(3, 5)));
break;
}
}
P.S:晨礼,晌礼,ASR,昏礼,宵礼是五个EditTexts。我试图使用待处理的意图和警报管理器来触发警报,但它没有奏效。有没有人有很好的建议?
什么没有奏效?让你的代码被触发?什么是“警报”,因为它看起来像一个AsyncTask? – 2012-07-25 22:58:40
重写问题。清晰的沟通是第一步。你需要说出什么是错的,你的代码被触发的地点/方式,以及你是否使用AlarmManager。如果不是,你可能会模仿。 – 2012-07-25 23:24:50
人们,请看上面的编辑。 – 2012-07-25 23:38:02