如何使用意图,查看日历数据?
问题描述:
我做了这个code:
long eventID = 208;
Uri uri = ContentUris.withAppendedId(Events.CONTENT_URI, eventID);
Intent intent = new Intent(Intent.ACTION_VIEW)
.setData(uri);
startActivity(intent);
我确定事件ID是正确的,而该事件标题显示在视图中是正确的。
I made sure the EventID was correct, and the event-title showed in the view was correct.
现在的问题是事件时间是不正确的,如:1970-1-1 8:00
THE PROBLEM is the event time was incorrect, like: 1970-1-1 8:00.
为什么呢?任何人都可以帮助吗?谢谢你。
Why? Anyone can Help? Thanks.
答
您必须添加事件开始和放大器;结束时间为意图的额外数据:
You have to add the event begin & end time to intent's extra data :
intent.putExtra("beginTime", beginMilliTS);
intent.putExtra("endTime", endMilliTS);
我从开始和事件实例的结束字段中的值得到了这个工作。 这应该也从一个事件DTSTART和DTEND字段。
I got this working by using the values from "begin" and "end" field of an event instance. This should work too with "dtstart" and "dtend" field from an event.