Intent that opens “new calendar event” activity

喜欢而已 提交于 2020-01-01 09:22:19

问题


In my app, I want a functionality to create calendar event. I open "new calendar event" activity like this:

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", eventStartInMillis);
intent.putExtra("endTime", eventEndInMillis);
startActivity(intent);

It works perfectly on stock Android. On HTC Sense, I have only one issue - end time is not set correctly, it's always one hour after begin time. What can be the problem?


回答1:


The problem was that I had a bug in my code - the value of eventEndInMillis was wrong and it was smaller then eventStartInMillis.



来源:https://stackoverflow.com/questions/2911731/intent-that-opens-new-calendar-event-activity

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!