Intent that opens “new calendar event” activity

2019-04-07 04:13发布

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条回答
相关推荐>>
2楼-- · 2019-04-07 04:41

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

查看更多
登录 后发表回答