0
我爲事件添加以下代碼:添加事件到Android日曆不顯示日曆
Intent calendarIntent = new Intent(Intent.ACTION_INSERT, Events.CONTENT_URI);
Calendar beginTime = Calendar.getInstance();
beginTime.set(2013,04,14,21,00,00);
Calendar endTime = Calendar.getInstance();
endTime.set(2013,04,14,21,10,00);
Intent intent = new Intent(Intent.ACTION_EDIT);
intent.setType("vnd.android.cursor.item/event");
intent.putExtra("title", "Some title");
intent.putExtra("description", "Some description");
intent.putExtra("beginTime", beginTime.getTimeInMillis());
intent.putExtra("endTime", endTime.getTimeInMillis());
startActivity(intent);
但如何插入事件,而不打開日曆?
感謝
感謝您的幫助,但我在這條線遇到錯誤:開放的URI = CR。插入(Events.CONTENT_URI,values); – Gold
你的api必須是14+ – rkmax
我的api是14+,並且在Uri uri = cr.insert(Events.CONTENT_URI,values)上仍然出錯。 – Gold