Service で次のメソッドを実装するにはどうすればよいですか。1 分ごとに動作するようにしたいです (現在の時刻に対応する場合、コードは日と時間のミントをチェックします)。多くの質問を見ましたが、役に立ちません。助けてください。ありがとうございました
{String[] 列 = 新しい String[] { KEY_ROWID, KEY_chNAME, KEY_prNAME, KEY_Rerun, KEY_HOUR, KEY_MINUTE, KEY_SUN, KEY_MON, KEY_TUE, KEY_WED, KEY_THU, KEY_FRI, KEY_SAT }; カーソル c = ourdatabase.query(DATABASE_TABLE, columns, null, null, null,null, null); 文字列結果 = "";
Calendar cl = Calendar.getInstance();
int today = cl.get(Calendar.DAY_OF_WEEK);
// String mStr="";
// mStr=mStr.concat("<body>");
// mStr=mStr.concat("<table border='1' ><tr> <th style='width:5px></th><td align='center'><b> Channal </b></td><td align='center'><b> Program </b></td><td align='center'><b> Time </b></tr>");
int iRow = c.getColumnIndex(KEY_ROWID);
int iCh = c.getColumnIndex(KEY_chNAME);
int ipr = c.getColumnIndex(KEY_prNAME);
int iHr = c.getColumnIndex(KEY_HOUR);
int iMin = c.getColumnIndex(KEY_MINUTE);
int iRerun = c.getColumnIndex(KEY_Rerun);
int iSun = c.getColumnIndex(KEY_SUN);
int iMon = c.getColumnIndex(KEY_MON);
int iTue = c.getColumnIndex(KEY_TUE);
int iWed = c.getColumnIndex(KEY_WED);
int iThu = c.getColumnIndex(KEY_THU);
int iFri = c.getColumnIndex(KEY_FRI);
int iSat = c.getColumnIndex(KEY_SAT);
DecimalFormat twoDigits = new DecimalFormat( "00" );
for (c.moveToFirst(); !c.isAfterLast(); c.moveToNext()) {
if (today == Integer.parseInt(c.getString(iSun))) {
result += c.getString(iRow) + " - " + c.getString(iCh) + "\t "
+ c.getString(ipr) + "\t " + c.getString(iHr) + ":"
+ twoDigits.format(Integer.parseInt(c.getString(iMin))) + " " + c.getString(iRerun) + "\n";
}
else if (today == Integer.parseInt(c.getString(iMon))) {
//int mm=Integer.parseInt( twoDigits.format(Integer.parseInt(c.getString(iMin))));
result += c.getString(iRow) + " - " + c.getString(iCh) + "\t "
+ c.getString(ipr) + "\t " + c.getString(iHr) + ":"
+ twoDigits.format(Integer.parseInt(c.getString(iMin))) + " " + c.getString(iRerun) + "\n";
}
else if (today == Integer.parseInt(c.getString(iTue))) {
result += c.getString(iRow) + " - " + c.getString(iCh) + "\t "
+ c.getString(ipr) + "\t " + c.getString(iHr) + ":"
+ twoDigits.format(Integer.parseInt(c.getString(iMin)))+ " " + c.getString(iRerun) + "\n";
}
else if (today == Integer.parseInt(c.getString(iWed))) {
result += c.getString(iRow) + " - " + c.getString(iCh) + "\t "
+ c.getString(ipr) + "\t " + c.getString(iHr) + ":"
+ twoDigits.format(Integer.parseInt(c.getString(iMin))) + " " + c.getString(iRerun) + "\n";
}
else if (today == Integer.parseInt(c.getString(iThu))) {
result += c.getString(iRow) + " - " + c.getString(iCh) + "\t "
+ c.getString(ipr) + "\t " + c.getString(iHr) + ":"
+ twoDigits.format(Integer.parseInt(c.getString(iMin))) + " " + c.getString(iRerun) + "\n";
}
else if (today == Integer.parseInt(c.getString(iFri))) {
result += c.getString(iRow) + " - " + c.getString(iCh) + "\t "
+ c.getString(ipr) + "\t " + c.getString(iHr) + ":"
+ twoDigits.format(Integer.parseInt(c.getString(iMin))) + " " + c.getString(iRerun) + "\n";
}
else if (today == Integer.parseInt(c.getString(iSat))) {
result += c.getString(iRow) + " - " + c.getString(iCh) + "\t "
+ c.getString(ipr) + "\t " + c.getString(iHr) + ":"
+twoDigits.format(Integer.parseInt(c.getString(iMin))) + " " + c.getString(iRerun) + "\n";
}
}
c.close(); }