如何以编程方式将日历活动设置为截止日期为29/10/2012的18:00? 我用这个,但我不太清楚如何将正确的值传递给这个日期。谢谢
Calendar cal = Calendar.getInstance();
Intent intent = new Intent(Intent.ACTION_EDIT);
intent.setType("vnd.android.cursor.item/event");
intent.putExtra("beginTime", cal.getTimeInMillis());
intent.putExtra("allDay", true);
intent.putExtra("rrule", "FREQ=YEARLY");
intent.putExtra("endTime", cal.getTimeInMillis()+60*60*1000);
intent.putExtra("title", "Giranice");
intent.putExtra("description", "Concierto Pop-Rock: Giranice (Gipuzkoa)");
intent.putExtra("eventLocation", "Bilborock");
startActivity(intent);
`
答案 0 :(得分:1)
我使用此功能,但我不太清楚如何将正确的值传递到此日期
使用它:
Calendar cal = Calendar.getInstance();
cal.set(Calendar.MONTH, month - 1);
cal.set(Calendar.YEAR, year);
cal.set(Calendar.DAY_OF_MONTH, day);
cal.set(Calendar.HOUR_OF_DAY, hourOfTheDay);
cal.set(Calendar.MINUTE, minute);
希望你能理解所有参数:)