0
我已經仔細研究過這個問題,我似乎無法找到任何人遇到同樣的困難。開始時間工作正常,但結束時間始終設置爲事件初始開始時間後的一個小時。Android日曆意圖事件結束總是在開始後一小時
Calendar calStart = Calendar.getInstance();
calStart.set(2014, 02, 04, 13, 20, 0);
Calendar calEnd = Calendar.getInstance();
calEnd.set(2014, 02, 04, 15, 30, 0);
Intent intent = new Intent(Intent.ACTION_INSERT)
.setData(Events.CONTENT_URI)
.putExtra(CalendarContract.EXTRA_EVENT_BEGIN_TIME, calStart.getTimeInMillis())
.putExtra(CalendarContract.EXTRA_EVENT_END_TIME, calEnd.getTimeInMillis())
.putExtra(Events.EVENT_TIMEZONE, TimeZone.getDefault().getID())
.putExtra(Events.TITLE, "TEST")
.putExtra(Events.EVENT_LOCATION, "Location")
.putExtra(Events.AVAILABILITY, Events.AVAILABILITY_BUSY);
startActivity(intent);
試試這個: intent.putExtra(Events.DTSTART,UTC millis自epoch以來); intent.putExtra(Events.DTEND,UTC millis自epoch以來); – KratosBala