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