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

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

问题描述

我编写了这段代码:

long eventID = 208;
Uri uri = ContentUris.withAppendedId(Events.CONTENT_URI, eventID);
Intent intent = new Intent(Intent.ACTION_VIEW)
   .setData(uri);
startActivity(intent);

我确保 EventID 是正确的,并且视图中显示的事件标题是正确的.

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.

推荐答案

你必须添加事件 begin &意图额外数据的结束时间:

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天全站免登陆