0
特定の日付と時刻のカレンダーを作成する必要があります。特定の日付と時刻のカレンダーの作成
private void setNotification(String date, String time) {
Log.i("log", "1");
//Get date & time
String[] dateArr = date.split(".");
String[] timeArr = date.split(":");
Log.i("log", "2");
//Set calender to lesson's date & time
Calendar cal = Calendar.getInstance();
cal.set(Integer.valueOf(dateArr[2]), Integer.valueOf(dateArr[1]) - 1, Integer.valueOf(dateArr[0]), Integer.valueOf(timeArr[0]), Integer.valueOf(timeArr[1]));
Log.i("log", "3");
//Schedule notification
scheduleNotification(CreateNewLesson.this, cal.getTimeInMillis() - Calendar.getInstance().getTimeInMillis(), Integer.valueOf(dateArr[0] + dateArr[1] + dateArr[2] + timeArr[0] + timeArr[1]));
}
日付文字列の書式がDD.MM.YYYYであり、時間がHHです:私は、関数を呼び出すとき、私は「2」のログではなく、「3」を参照してくださいすることができ、MM。
なぜですか?
提示したコードが不完全で実際のサンプル入力が含まれていないため、あなたの行動を観察する理由が推測できます。あなたが提起した質問に答えたいなら、[mcve]を提示してください。 –
タスクに適切なツールを使用し、自分で日付を解析しないでください。 – Tunaki