如何使用意图,查看日历数据? [英] How to using intents to view calendar data?

查看:138
本文介绍了如何使用意图,查看日历数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我做了这个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.

这篇关于如何使用意图,查看日历数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆